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,15 +468,28 @@ export default {
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
this.$request(request).asyncThen((resp) => { this.$request(request)
.asyncThen((resp) => {
console.log('审批流程数据:', resp) console.log('审批流程数据:', resp)
this.flowStatus = resp.data?.flowStatus
//
this.detailOption = resp.data?.explanation || resp.data?.description || ''
let list = []
const data = resp.data || 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 || []
// flowNodes使
if (!this.flowNodes || this.flowNodes.length === 0) {
let list = []
// //
if (data.proofreadNodes && Array.isArray(data.proofreadNodes) && data.proofreadNodes.length > 0) { if (data.proofreadNodes && Array.isArray(data.proofreadNodes) && data.proofreadNodes.length > 0) {
const steps = data.proofreadNodes const steps = data.proofreadNodes
@ -447,7 +545,13 @@ export default {
} }
this.progress = list this.progress = list
console.log('处理后的流程数据:', this.progress) console.log('处理后的流程数据(兼容模式):', this.progress)
}
})
.asyncErrorCatch((err) => {
console.error('获取审批流程数据失败:', err)
this.flowNodes = []
this.progressDetailData = {}
}) })
}, },
getApprovalChange() { getApprovalChange() {

View File

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

View File

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