fix:修改bug

This commit is contained in:
大黑 2025-12-25 10:21:01 +08:00
parent 82499cf1fa
commit f280a779b3
7 changed files with 712 additions and 370 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -134,7 +134,7 @@
<div class="node-user"> <div class="node-user">
{{ node.userName || '--' }} {{ node.userName || '--' }}
<span class="node-time"> <span class="node-time">
{{ formatTime(node.time) }} {{ formatTime(node.operateTime) }}
</span> </span>
</div> </div>
</div> </div>
@ -209,7 +209,9 @@ export default {
data() { data() {
return { return {
changeTable: [], changeTable: [],
progress: [], progress: [], //
flowNodes: [], //
progressDetailData: {}, //
detailOption: '', detailOption: '',
flowStatus: '', flowStatus: '',
changeTableTotal: 0, changeTableTotal: 0,
@ -232,6 +234,16 @@ export default {
}, },
computed: { computed: {
progressDetail() { progressDetail() {
// 使使
if (this.progressDetailData && Object.keys(this.progressDetailData).length > 0) {
return {
progressTitle: this.progressDetailData.progressTitle || '',
contentName: this.progressDetailData.contentName || '',
templateVersion: this.progressDetailData.templateVersion || '',
explanation: this.progressDetailData.explanation || '',
description: this.progressDetailData.explanation || this.progressDetailData.description || ''
}
}
const defaultDetail = { const defaultDetail = {
approvalNumber: '', approvalNumber: '',
modelName: '', modelName: '',
@ -265,22 +277,92 @@ export default {
nodes.push({ nodes.push({
title: '提交申请', title: '提交申请',
userName: this.detail.username, userName: this.detail.username,
time: this.detail.createdTime, operateTime: this.detail.createdTime,
result: 'INITIATE', result: 'INITIATE',
status: 'INITIATE', status: 'INITIATE',
opinion: this.initiateNode.opinion || this.initiateNode.remark || this.initiateNode.comment || null opinion: this.initiateNode.opinion || this.initiateNode.remark || this.initiateNode.comment || null
}) })
} }
// // 使 flowNodes
if (this.progress && this.progress.length > 0) { if (this.flowNodes && this.flowNodes.length > 0) {
// nodeOrder
const sortedNodes = [...this.flowNodes].sort((a, b) => {
const orderA = a.nodeOrder !== undefined && a.nodeOrder !== null ? Number(a.nodeOrder) : 0
const orderB = b.nodeOrder !== undefined && b.nodeOrder !== null ? Number(b.nodeOrder) : 0
return orderA - orderB
})
// REJECT
const rejectIndex = sortedNodes.findIndex((node) => node.result === 'REJECT')
let processedNodes = sortedNodes
if (rejectIndex !== -1) {
// REJECT
processedNodes = sortedNodes.slice(0, rejectIndex + 1)
} else {
// REJECT result "" APPROVING
const stayIndex = processedNodes.findIndex((node) => node.result === '待审批')
if (stayIndex !== -1) {
processedNodes = processedNodes.map((node, index) => {
if (index === stayIndex) {
return {
...node,
result: 'APPROVING'
}
}
return node
})
}
}
// 线
processedNodes.forEach((node) => {
let result = 'APPROVING'
let status = 'APPROVING'
if (node.result) {
if (node.result === 'REJECT') {
result = 'REJECT'
status = 'REJECT'
} else if (node.result === 'APPROVING') {
result = 'APPROVING'
status = 'APPROVING'
} else if (node.result === 'PASS') {
result = 'PASS'
status = 'PASS'
} else if (node.result === '待审批') {
result = 'STAY'
status = 'STAY'
}
}
// opinions
const opinion = node.opinions && Array.isArray(node.opinions) && node.opinions.length > 0
? node.opinions[0]
: null
// 使 todoUserName使 undoUserName
const userName = node.todoUserName || node.undoUserName || '--'
nodes.push({
title: node.node || '审批节点',
userName: userName,
operateTime: node.approvalTime || '',
result: result,
status: status,
opinion: opinion
})
})
} else if (this.progress && this.progress.length > 0) {
// flowNodes使 progress
this.progress.forEach((stage) => { this.progress.forEach((stage) => {
if (stage.steps && stage.steps.length > 0) { if (stage.steps && stage.steps.length > 0) {
stage.steps.forEach((step) => { stage.steps.forEach((step) => {
nodes.push({ nodes.push({
title: stage.title || '审批节点', title: stage.title || '审批节点',
userName: step.userName, userName: step.userName,
time: step.approvalTime || step.handleTime || step.createTime, operateTime: step.approvalTime || step.handleTime || step.createTime,
result: step.result || step.status, result: step.result || step.status,
status: step.result || step.status, status: step.result || step.status,
opinion: step.opinion || step.remark || step.comment || null opinion: step.opinion || step.remark || step.comment || null
@ -375,6 +457,9 @@ export default {
return classMap[result] || 'status-default' return classMap[result] || 'status-default'
}, },
getApprovalSpet() { getApprovalSpet() {
if (!this.detail || !this.detail.flowId) {
return
}
const request = { const request = {
...api.GET_PPROVAL_ALL, ...api.GET_PPROVAL_ALL,
params: { params: {
@ -383,72 +468,91 @@ export default {
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
this.$request(request).asyncThen((resp) => { this.$request(request)
console.log('审批流程数据:', resp) .asyncThen((resp) => {
this.flowStatus = resp.data?.flowStatus console.log('审批流程数据:', resp)
// const data = resp.data || resp
this.detailOption = resp.data?.explanation || resp.data?.description || '' //
this.flowStatus = data.flowStatus || ''
let list = [] //
const data = resp.data || resp this.progressDetailData = {
explanation: data.explanation || '',
// flowStatus: data.flowStatus || '',
if (data.proofreadNodes && Array.isArray(data.proofreadNodes) && data.proofreadNodes.length > 0) { progressTitle: data.progressTitle || '',
const steps = data.proofreadNodes templateVersion: data.templateVersion || '',
list.push({ contentName: data.contentName || ''
title: '校对',
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
})
}
//
if (data.reviewNodes && Array.isArray(data.reviewNodes) && data.reviewNodes.length > 0) {
const steps = data.reviewNodes
list.push({
title: '审核',
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
})
}
//
if (data.countersignNodes && Array.isArray(data.countersignNodes) && data.countersignNodes.length > 0) {
const steps = data.countersignNodes
list.push({
title: '会签',
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
})
}
//
if (data.approveNodes && Array.isArray(data.approveNodes) && data.approveNodes.length > 0) {
const steps = data.approveNodes
list.push({
title: '批准',
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
})
}
// 使
if (list.length === 0 && data) {
// 使
if (Array.isArray(data)) {
list = data.map(item => ({
title: item.title || item.nodeType || item.name || '审批节点',
steps: this.deduplicateSteps(Array.isArray(item.steps) ? item.steps : (Array.isArray(item.nodes) ? item.nodes : []))
}))
} else if (data.nodes && Array.isArray(data.nodes)) {
list = data.nodes.map(item => ({
title: item.title || item.nodeType || item.name || '审批节点',
steps: this.deduplicateSteps(Array.isArray(item.steps) ? item.steps : (Array.isArray(item.nodes) ? item.nodes : []))
}))
} else if (data.processNodes && Array.isArray(data.processNodes)) {
list = data.processNodes.map(item => ({
title: item.title || item.nodeType || item.name || '审批节点',
steps: this.deduplicateSteps(Array.isArray(item.steps) ? item.steps : (Array.isArray(item.nodes) ? item.nodes : []))
}))
} }
} //
this.detailOption = data.explanation || data.description || ''
//
this.flowNodes = data.flowNodes || []
this.progress = list // flowNodes使
console.log('处理后的流程数据:', this.progress) if (!this.flowNodes || this.flowNodes.length === 0) {
}) let list = []
//
if (data.proofreadNodes && Array.isArray(data.proofreadNodes) && data.proofreadNodes.length > 0) {
const steps = data.proofreadNodes
list.push({
title: '校对',
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
})
}
//
if (data.reviewNodes && Array.isArray(data.reviewNodes) && data.reviewNodes.length > 0) {
const steps = data.reviewNodes
list.push({
title: '审核',
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
})
}
//
if (data.countersignNodes && Array.isArray(data.countersignNodes) && data.countersignNodes.length > 0) {
const steps = data.countersignNodes
list.push({
title: '会签',
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
})
}
//
if (data.approveNodes && Array.isArray(data.approveNodes) && data.approveNodes.length > 0) {
const steps = data.approveNodes
list.push({
title: '批准',
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
})
}
// 使
if (list.length === 0 && data) {
// 使
if (Array.isArray(data)) {
list = data.map(item => ({
title: item.title || item.nodeType || item.name || '审批节点',
steps: this.deduplicateSteps(Array.isArray(item.steps) ? item.steps : (Array.isArray(item.nodes) ? item.nodes : []))
}))
} else if (data.nodes && Array.isArray(data.nodes)) {
list = data.nodes.map(item => ({
title: item.title || item.nodeType || item.name || '审批节点',
steps: this.deduplicateSteps(Array.isArray(item.steps) ? item.steps : (Array.isArray(item.nodes) ? item.nodes : []))
}))
} else if (data.processNodes && Array.isArray(data.processNodes)) {
list = data.processNodes.map(item => ({
title: item.title || item.nodeType || item.name || '审批节点',
steps: this.deduplicateSteps(Array.isArray(item.steps) ? item.steps : (Array.isArray(item.nodes) ? item.nodes : []))
}))
}
}
this.progress = list
console.log('处理后的流程数据(兼容模式):', this.progress)
}
})
.asyncErrorCatch((err) => {
console.error('获取审批流程数据失败:', err)
this.flowNodes = []
this.progressDetailData = {}
})
}, },
getApprovalChange() { getApprovalChange() {
const request = { const request = {

View File

@ -1286,11 +1286,18 @@ export default {
// section // section
if (nodeInfo.isParent) { if (nodeInfo.isParent) {
const sectionData = data[sectionName] || [] const sectionData = data[sectionName] || []
const hasDataInSubsystem = sectionData.some( // sectionName "/"
(param) => param.subsystemName === nodeInfo.label // sectionName
) if (sectionName === nodeInfo.label) {
if (hasDataInSubsystem) {
hasMatch = true hasMatch = true
} else {
// section
const hasDataInSubsystem = sectionData.some(
(param) => param.subsystemName === nodeInfo.label
)
if (hasDataInSubsystem) {
hasMatch = true
}
} }
} }
} }

View File

@ -1127,7 +1127,6 @@ export default {
return formatted return formatted
} }
return data.map((node) => formatNode(node)) return data.map((node) => formatNode(node))
}, },
// //