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">
{{ node.userName || '--' }}
<span class="node-time">
{{ formatTime(node.time) }}
{{ formatTime(node.operateTime) }}
</span>
</div>
</div>
@ -209,7 +209,9 @@ export default {
data() {
return {
changeTable: [],
progress: [],
progress: [], //
flowNodes: [], //
progressDetailData: {}, //
detailOption: '',
flowStatus: '',
changeTableTotal: 0,
@ -232,6 +234,16 @@ export default {
},
computed: {
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 = {
approvalNumber: '',
modelName: '',
@ -265,22 +277,92 @@ export default {
nodes.push({
title: '提交申请',
userName: this.detail.username,
time: this.detail.createdTime,
operateTime: this.detail.createdTime,
result: 'INITIATE',
status: 'INITIATE',
opinion: this.initiateNode.opinion || this.initiateNode.remark || this.initiateNode.comment || null
})
}
//
if (this.progress && this.progress.length > 0) {
// 使 flowNodes
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) => {
if (stage.steps && stage.steps.length > 0) {
stage.steps.forEach((step) => {
nodes.push({
title: stage.title || '审批节点',
userName: step.userName,
time: step.approvalTime || step.handleTime || step.createTime,
operateTime: step.approvalTime || step.handleTime || step.createTime,
result: step.result || step.status,
status: step.result || step.status,
opinion: step.opinion || step.remark || step.comment || null
@ -375,6 +457,9 @@ export default {
return classMap[result] || 'status-default'
},
getApprovalSpet() {
if (!this.detail || !this.detail.flowId) {
return
}
const request = {
...api.GET_PPROVAL_ALL,
params: {
@ -383,72 +468,91 @@ export default {
},
disableSuccessMsg: true
}
this.$request(request).asyncThen((resp) => {
console.log('审批流程数据:', resp)
this.flowStatus = resp.data?.flowStatus
//
this.detailOption = resp.data?.explanation || resp.data?.description || ''
let list = []
const data = resp.data || resp
//
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.$request(request)
.asyncThen((resp) => {
console.log('审批流程数据:', resp)
const data = resp.data || resp
//
this.flowStatus = data.flowStatus || ''
//
this.progressDetailData = {
explanation: data.explanation || '',
flowStatus: data.flowStatus || '',
progressTitle: data.progressTitle || '',
templateVersion: data.templateVersion || '',
contentName: data.contentName || ''
}
}
//
this.detailOption = data.explanation || data.description || ''
//
this.flowNodes = data.flowNodes || []
this.progress = list
console.log('处理后的流程数据:', this.progress)
})
// flowNodes使
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() {
const request = {

View File

@ -1286,11 +1286,18 @@ export default {
// section
if (nodeInfo.isParent) {
const sectionData = data[sectionName] || []
const hasDataInSubsystem = sectionData.some(
(param) => param.subsystemName === nodeInfo.label
)
if (hasDataInSubsystem) {
// sectionName "/"
// sectionName
if (sectionName === nodeInfo.label) {
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 data.map((node) => formatNode(node))
},
//