fix:修改bug
This commit is contained in:
parent
f765a9fb61
commit
82499cf1fa
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
@ -41,15 +41,15 @@
|
|||||||
<div class="info-grid">
|
<div class="info-grid">
|
||||||
<div class="info-item">
|
<div class="info-item">
|
||||||
<span class="label">流程主题</span>
|
<span class="label">流程主题</span>
|
||||||
<span class="value">{{ progressDetail.modelName || '--' }}</span>
|
<span class="value">{{ progressDetail.progressTitle || '--' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-item">
|
<div class="info-item">
|
||||||
<span class="label">模板名称</span>
|
<span class="label">模板名称</span>
|
||||||
<span class="value">{{ progressDetail.applicant || '--' }}</span>
|
<span class="value">{{ progressDetail.contentName || '--' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-item">
|
<div class="info-item">
|
||||||
<span class="label">版本</span>
|
<span class="label">版本</span>
|
||||||
<span class="value">{{ progressDetail.submitTime || '--' }}</span>
|
<span class="value">{{ progressDetail.templateVersion || '--' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -731,7 +731,7 @@ export default {
|
|||||||
|
|
||||||
.info-grid {
|
.info-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, minmax(200px, 1fr));
|
grid-template-columns: repeat(3, minmax(200px, 1fr));
|
||||||
gap: 16px 24px;
|
gap: 16px 24px;
|
||||||
|
|
||||||
.info-item {
|
.info-item {
|
||||||
|
|||||||
@ -22,7 +22,12 @@
|
|||||||
<el-button size="small" @click="handleReject">
|
<el-button size="small" @click="handleReject">
|
||||||
退回
|
退回
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="detail.statusDescription === '审核中'" type="primary" size="small" @click="handleSubmit">
|
<el-button
|
||||||
|
v-if="detail.statusDescription === '审核中'"
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleSubmit"
|
||||||
|
>
|
||||||
提交
|
提交
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -51,12 +56,7 @@
|
|||||||
<div class="section-title">
|
<div class="section-title">
|
||||||
审批内容
|
审批内容
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table :data="changeTable || []" border class="change-table" :max-height="500">
|
||||||
:data="changeTable || []"
|
|
||||||
border
|
|
||||||
class="change-table"
|
|
||||||
:max-height="500"
|
|
||||||
>
|
|
||||||
<el-table-column label="序号" type="index" width="60" />
|
<el-table-column label="序号" type="index" width="60" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="subsystemName"
|
prop="subsystemName"
|
||||||
@ -84,12 +84,7 @@
|
|||||||
/>
|
/>
|
||||||
<el-table-column prop="parameterValue" label="参数值" min-width="160">
|
<el-table-column prop="parameterValue" label="参数值" min-width="160">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column prop="unit" label="单位" min-width="80" show-overflow-tooltip />
|
||||||
prop="unit"
|
|
||||||
label="单位"
|
|
||||||
min-width="80"
|
|
||||||
show-overflow-tooltip
|
|
||||||
/>
|
|
||||||
<el-table-column prop="changeComment" label="修改描述" min-width="160">
|
<el-table-column prop="changeComment" label="修改描述" min-width="160">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -299,22 +294,24 @@ export default {
|
|||||||
let status = 'APPROVING'
|
let status = 'APPROVING'
|
||||||
|
|
||||||
if (record.operate) {
|
if (record.operate) {
|
||||||
const operate = String(record.operate).toUpperCase()
|
if (record.operate === 'REJECT') {
|
||||||
if (operate === 'REJECT') {
|
|
||||||
result = 'REJECT'
|
result = 'REJECT'
|
||||||
status = 'REJECT'
|
status = 'REJECT'
|
||||||
} else if (operate === 'APPROVING') {
|
} else if (record.operate === 'APPROVING') {
|
||||||
result = 'APPROVING'
|
result = 'APPROVING'
|
||||||
status = 'APPROVING'
|
status = 'APPROVING'
|
||||||
} else if (operate === 'PASS') {
|
} else if (record.operate === 'PASS') {
|
||||||
result = 'PASS'
|
result = 'PASS'
|
||||||
status = 'PASS'
|
status = 'PASS'
|
||||||
|
} else if (record.operate === '待审批') {
|
||||||
|
result = 'STAY'
|
||||||
|
status = 'STAY'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes.push({
|
nodes.push({
|
||||||
title: record.node || '审批节点',
|
title: record.node || '审批节点',
|
||||||
userName: record.approverPersons || '--',
|
userName: record.unapprovedPerson || '--',
|
||||||
operateTime: record.approvalTime || record.handleTime || record.createTime || '',
|
operateTime: record.approvalTime || record.handleTime || record.createTime || '',
|
||||||
result: result,
|
result: result,
|
||||||
status: status,
|
status: status,
|
||||||
@ -328,7 +325,7 @@ export default {
|
|||||||
stage.steps.forEach((step) => {
|
stage.steps.forEach((step) => {
|
||||||
nodes.push({
|
nodes.push({
|
||||||
title: '审批节点',
|
title: '审批节点',
|
||||||
userName: step.approverPersons,
|
userName: step.unapprovedPerson,
|
||||||
time: step.approvalTime || step.handleTime || step.createTime,
|
time: 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,
|
||||||
@ -371,7 +368,6 @@ export default {
|
|||||||
console.error('获取审批变更失败:', err)
|
console.error('获取审批变更失败:', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getApprovalDetail() {
|
getApprovalDetail() {
|
||||||
const request = {
|
const request = {
|
||||||
...api.GET_ENGINE_CHECK_DETAIL,
|
...api.GET_ENGINE_CHECK_DETAIL,
|
||||||
@ -389,12 +385,14 @@ export default {
|
|||||||
// 如果返回的是分页格式 { list: [], total: 0 }
|
// 如果返回的是分页格式 { list: [], total: 0 }
|
||||||
if (resp.data.list && Array.isArray(resp.data.list)) {
|
if (resp.data.list && Array.isArray(resp.data.list)) {
|
||||||
allData = resp.data.list
|
allData = resp.data.list
|
||||||
this.changeTableTotal = resp.data.total || resp.data.totalCount || resp.data.count || allData.length
|
this.changeTableTotal =
|
||||||
|
resp.data.total || resp.data.totalCount || resp.data.count || allData.length
|
||||||
} else if (resp.data.activitiDataDTOS) {
|
} else if (resp.data.activitiDataDTOS) {
|
||||||
// 如果返回的是 activitiDataDTOS 数组
|
// 如果返回的是 activitiDataDTOS 数组
|
||||||
allData = Array.isArray(resp.data.activitiDataDTOS) ? resp.data.activitiDataDTOS : []
|
allData = Array.isArray(resp.data.activitiDataDTOS) ? resp.data.activitiDataDTOS : []
|
||||||
// 如果没有分页信息,使用数组长度作为总数
|
// 如果没有分页信息,使用数组长度作为总数
|
||||||
this.changeTableTotal = resp.data.total || resp.data.totalCount || resp.data.count || allData.length
|
this.changeTableTotal =
|
||||||
|
resp.data.total || resp.data.totalCount || resp.data.count || allData.length
|
||||||
} else if (Array.isArray(resp.data)) {
|
} else if (Array.isArray(resp.data)) {
|
||||||
// 如果直接返回数组
|
// 如果直接返回数组
|
||||||
allData = resp.data
|
allData = resp.data
|
||||||
@ -415,11 +413,36 @@ export default {
|
|||||||
|
|
||||||
// 保存审批流程数据,按照 nodeOrder 从小到大排序
|
// 保存审批流程数据,按照 nodeOrder 从小到大排序
|
||||||
const activitiRecordDTOS = resp.data?.activitiRecordDTOS || []
|
const activitiRecordDTOS = resp.data?.activitiRecordDTOS || []
|
||||||
this.activitiRecordDTOS = activitiRecordDTOS.sort((a, b) => {
|
let sortedRecords = activitiRecordDTOS.sort((a, b) => {
|
||||||
const orderA = a.nodeOrder !== undefined && a.nodeOrder !== null ? Number(a.nodeOrder) : 0
|
const orderA = a.nodeOrder !== undefined && a.nodeOrder !== null ? Number(a.nodeOrder) : 0
|
||||||
const orderB = b.nodeOrder !== undefined && b.nodeOrder !== null ? Number(b.nodeOrder) : 0
|
const orderB = b.nodeOrder !== undefined && b.nodeOrder !== null ? Number(b.nodeOrder) : 0
|
||||||
return orderA - orderB
|
return orderA - orderB
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 查找是否有 REJECT 节点
|
||||||
|
const rejectIndex = sortedRecords.findIndex((record) => record.operate === 'REJECT')
|
||||||
|
|
||||||
|
if (rejectIndex !== -1) {
|
||||||
|
// 如果有 REJECT 节点,删除该节点后面的所有节点
|
||||||
|
sortedRecords = sortedRecords.slice(0, rejectIndex + 1)
|
||||||
|
} else {
|
||||||
|
// 如果没有 REJECT,将第一个 operate 是"待审批"的节点改为 APPROVING
|
||||||
|
const stayIndex = sortedRecords.findIndex((record) => record.operate === '待审批')
|
||||||
|
if (stayIndex !== -1) {
|
||||||
|
// 创建新对象,避免直接修改原对象
|
||||||
|
sortedRecords = sortedRecords.map((record, index) => {
|
||||||
|
if (index === stayIndex) {
|
||||||
|
return {
|
||||||
|
...record,
|
||||||
|
operate: 'APPROVING'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return record
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.activitiRecordDTOS = sortedRecords
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 根据分页配置更新当前页显示的数据
|
// 根据分页配置更新当前页显示的数据
|
||||||
@ -428,11 +451,9 @@ export default {
|
|||||||
this.changeTable = []
|
this.changeTable = []
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算当前页的起始索引和结束索引
|
// 计算当前页的起始索引和结束索引
|
||||||
const startIndex = (this.changeTablePageNumber - 1) * this.changeTablePageSize
|
const startIndex = (this.changeTablePageNumber - 1) * this.changeTablePageSize
|
||||||
const endIndex = startIndex + this.changeTablePageSize
|
const endIndex = startIndex + this.changeTablePageSize
|
||||||
|
|
||||||
// 截取当前页的数据
|
// 截取当前页的数据
|
||||||
this.changeTable = this.changeTableAll.slice(startIndex, endIndex)
|
this.changeTable = this.changeTableAll.slice(startIndex, endIndex)
|
||||||
},
|
},
|
||||||
@ -445,6 +466,7 @@ export default {
|
|||||||
APPROVING: '审批中',
|
APPROVING: '审批中',
|
||||||
PENDING: '待处理',
|
PENDING: '待处理',
|
||||||
WAITING: '待处理',
|
WAITING: '待处理',
|
||||||
|
STAY: '待审批',
|
||||||
INITIATE: '发起审批'
|
INITIATE: '发起审批'
|
||||||
}
|
}
|
||||||
return statusMap[result] || result || '待处理'
|
return statusMap[result] || result || '待处理'
|
||||||
@ -474,6 +496,8 @@ export default {
|
|||||||
return '#F56C6C' // 红色 - 驳回
|
return '#F56C6C' // 红色 - 驳回
|
||||||
} else if (result === 'APPROVING' || result === 'PENDING' || result === 'WAITING') {
|
} else if (result === 'APPROVING' || result === 'PENDING' || result === 'WAITING') {
|
||||||
return '#E6A23C' // 橙色 - 审批中
|
return '#E6A23C' // 橙色 - 审批中
|
||||||
|
} else if (result === 'STAY') {
|
||||||
|
return '#909399' // 灰色 - 待审批
|
||||||
} else if (result === 'INITIATE') {
|
} else if (result === 'INITIATE') {
|
||||||
return '#409EFF' // 蓝色 - 发起审批
|
return '#409EFF' // 蓝色 - 发起审批
|
||||||
}
|
}
|
||||||
@ -489,6 +513,7 @@ export default {
|
|||||||
APPROVING: 'status-approving',
|
APPROVING: 'status-approving',
|
||||||
PENDING: 'status-pending',
|
PENDING: 'status-pending',
|
||||||
WAITING: 'status-pending',
|
WAITING: 'status-pending',
|
||||||
|
STAY: 'status-default',
|
||||||
INITIATE: 'status-initiate'
|
INITIATE: 'status-initiate'
|
||||||
}
|
}
|
||||||
return classMap[result] || 'status-default'
|
return classMap[result] || 'status-default'
|
||||||
@ -509,7 +534,6 @@ export default {
|
|||||||
|
|
||||||
let list = []
|
let list = []
|
||||||
const data = resp.data || resp
|
const data = resp.data || resp
|
||||||
|
|
||||||
// 处理校对节点
|
// 处理校对节点
|
||||||
if (
|
if (
|
||||||
data.proofreadNodes &&
|
data.proofreadNodes &&
|
||||||
@ -577,7 +601,6 @@ export default {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.progress = list
|
this.progress = list
|
||||||
console.log('处理后的流程数据:', this.progress)
|
console.log('处理后的流程数据:', this.progress)
|
||||||
})
|
})
|
||||||
@ -621,18 +644,15 @@ export default {
|
|||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.detail || !this.detail.id) {
|
if (!this.detail || !this.detail.id) {
|
||||||
this.$message.error('缺少审批数据')
|
this.$message.error('缺少审批数据')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const approvalId = this.detail.id
|
const approvalId = this.detail.id
|
||||||
if (!approvalId) {
|
if (!approvalId) {
|
||||||
this.$message.error('缺少审批ID,无法提交审批')
|
this.$message.error('缺少审批ID,无法提交审批')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建提交数据
|
// 构建提交数据
|
||||||
// 根据操作类型设置 operator:退回为 'REJECT',提交为 'PASS'
|
// 根据操作类型设置 operator:退回为 'REJECT',提交为 'PASS'
|
||||||
const operator = this.approvalActionType === 'reject' ? 'REJECT' : 'PASS'
|
const operator = this.approvalActionType === 'reject' ? 'REJECT' : 'PASS'
|
||||||
|
|||||||
@ -325,7 +325,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.loadUserSelfRole()
|
this.loadUserSelfRole()
|
||||||
this.loadTemplateOptions()
|
this.loadTemplateOptions()
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<div class="header-item">
|
<div class="header-item">
|
||||||
<span class="label">{{ isApprovalMode ? '发起审批' : '模板名称' }}:</span>
|
<span class="label">{{ isApprovalMode ? '发起审批' : '模板名称' }}:</span>
|
||||||
<span class="value">{{
|
<span class="value" v-if="!isApprovalMode">{{
|
||||||
isApprovalMode ? '系统参数模板' : displayTemplateName || '系统参数'
|
isApprovalMode ? '系统参数模板' : displayTemplateName || '系统参数'
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -158,6 +158,47 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</x-vxe-table>
|
</x-vxe-table>
|
||||||
|
|
||||||
|
<!-- 审批流程 -->
|
||||||
|
<div v-if="!isMaintainMode && !isApprovalMode && detail && detail.flowId" class="approval-progress-section">
|
||||||
|
<div class="section-title">
|
||||||
|
审批流程
|
||||||
|
</div>
|
||||||
|
<div v-if="timelineNodes && timelineNodes.length > 0" class="approval-timeline">
|
||||||
|
<el-timeline>
|
||||||
|
<el-timeline-item
|
||||||
|
v-for="(node, index) in timelineNodes"
|
||||||
|
:key="index"
|
||||||
|
:color="getTimelineColor(node.result || node.status, index, timelineNodes.length)"
|
||||||
|
>
|
||||||
|
<div class="timeline-item-content">
|
||||||
|
<div class="node-title">
|
||||||
|
{{ node.title }}
|
||||||
|
</div>
|
||||||
|
<div class="node-content">
|
||||||
|
<div class="node-info">
|
||||||
|
<div class="node-user">
|
||||||
|
{{ node.userName || '--' }}
|
||||||
|
<span class="node-time">
|
||||||
|
{{ formatTime(node.operateTime) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="node-status" :class="getStatusClass(node.result || node.status)">
|
||||||
|
{{ setStatusText(node.result || node.status) }}
|
||||||
|
</div>
|
||||||
|
<div v-if="node.opinion" class="node-opinion">
|
||||||
|
审批意见:{{ node.opinion }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-timeline-item>
|
||||||
|
</el-timeline>
|
||||||
|
</div>
|
||||||
|
<div v-else class="empty-progress">
|
||||||
|
<span class="empty-text">暂无审批流程数据</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 审批内容区域 -->
|
<!-- 审批内容区域 -->
|
||||||
@ -595,7 +636,10 @@ export default {
|
|||||||
checkStrictly: true, // 允许选择任意一级(单选)
|
checkStrictly: true, // 允许选择任意一级(单选)
|
||||||
emitPath: false, // 只返回最后一级的值(单选时只返回选中的id)
|
emitPath: false, // 只返回最后一级的值(单选时只返回选中的id)
|
||||||
multiple: false // 明确指定为单选
|
multiple: false // 明确指定为单选
|
||||||
}
|
},
|
||||||
|
// 审批流程相关
|
||||||
|
flowNodes: [], // 审批流程节点数据
|
||||||
|
progressDetail: {} // 审批流程详情数据
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -858,6 +902,84 @@ export default {
|
|||||||
value: [{ required: true, message: '请输入数值', trigger: 'blur' }]
|
value: [{ required: true, message: '请输入数值', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 审批流程时间线节点
|
||||||
|
timelineNodes() {
|
||||||
|
const nodes = []
|
||||||
|
if (!this.flowNodes || this.flowNodes.length === 0) {
|
||||||
|
return nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按照 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
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return nodes
|
||||||
|
},
|
||||||
// 过滤后的部门树数据
|
// 过滤后的部门树数据
|
||||||
filteredDepartmentTreeData() {
|
filteredDepartmentTreeData() {
|
||||||
if (!this.departmentSearchText || this.departmentSearchText.trim() === '') {
|
if (!this.departmentSearchText || this.departmentSearchText.trim() === '') {
|
||||||
@ -972,6 +1094,12 @@ export default {
|
|||||||
// 如果 detail 中没有状态,从 versionList 中获取
|
// 如果 detail 中没有状态,从 versionList 中获取
|
||||||
this.updateCurrentStatus()
|
this.updateCurrentStatus()
|
||||||
}
|
}
|
||||||
|
// 如果有 flowId,获取审批流程数据
|
||||||
|
if (newDetail && newDetail.flowId) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.getApprovalSpet()
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true
|
deep: true
|
||||||
@ -1004,6 +1132,10 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadDepartmentList()
|
this.loadDepartmentList()
|
||||||
|
// 如果有 flowId,获取审批流程数据
|
||||||
|
if (this.detail && this.detail.flowId) {
|
||||||
|
this.getApprovalSpet()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 加载用户自身角色权限
|
// 加载用户自身角色权限
|
||||||
@ -1085,9 +1217,9 @@ export default {
|
|||||||
const checkSubsystem = subsystem || this.displayTemplateName
|
const checkSubsystem = subsystem || this.displayTemplateName
|
||||||
return this.checkPermission('模板管理', checkSubsystem, '编辑')
|
return this.checkPermission('模板管理', checkSubsystem, '编辑')
|
||||||
},
|
},
|
||||||
// 检查参数是否有编辑权限(根据parameterName匹配)
|
// 检查参数是否有编辑权限(根据subsystem和partsName匹配)
|
||||||
hasParameterEditPermission(parameterName) {
|
hasParameterEditPermission(subsystem, partsName) {
|
||||||
if (!parameterName) {
|
if (!subsystem || !partsName) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 优先使用传入的权限数组
|
// 优先使用传入的权限数组
|
||||||
@ -1099,8 +1231,13 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查 parameterName 是否匹配
|
// 检查 subsystem 是否匹配
|
||||||
if (perm.parameterName !== parameterName) {
|
if (perm.subsystem !== subsystem) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查 partsName 是否匹配
|
||||||
|
if (perm.partsName !== partsName) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,7 +1258,7 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查找匹配的权限:menuPath包含"模板管理",subsystem匹配templateName,parameterName匹配,且parameterPer为"编辑"
|
// 查找匹配的权限:menuPath包含"模板管理",subsystem匹配,partsName匹配,且parameterPer为"编辑"
|
||||||
const templateName = this.displayTemplateName
|
const templateName = this.displayTemplateName
|
||||||
const matchedPermissions = permissionData.filter((perm) => {
|
const matchedPermissions = permissionData.filter((perm) => {
|
||||||
// 检查 menuPath 是否匹配
|
// 检查 menuPath 是否匹配
|
||||||
@ -1130,13 +1267,18 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查 subsystem 是否匹配 templateName
|
// 检查 subsystem 是否匹配 templateName(如果 templateName 存在)
|
||||||
if (templateName && perm.subsystem !== templateName) {
|
if (templateName && perm.subsystem !== templateName) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查 parameterName 是否匹配
|
// 检查 subsystem 是否匹配
|
||||||
if (perm.parameterName !== parameterName) {
|
if (perm.subsystem !== subsystem) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查 partsName 是否匹配
|
||||||
|
if (perm.partsName !== partsName) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1159,9 +1301,10 @@ export default {
|
|||||||
if (row.createdBy === getUserId()) {
|
if (row.createdBy === getUserId()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// 如果参数名称在权限数组中,且权限类型为"编辑",可以编辑/删除
|
// 根据子系统和零部件名称检查是否有编辑权限
|
||||||
const parameterName = row.parameterName
|
const subsystem = row.subsystemName || row.subsystem || ''
|
||||||
if (parameterName && this.hasParameterEditPermission(parameterName)) {
|
const partsName = row.partsName || ''
|
||||||
|
if (subsystem && partsName && this.hasParameterEditPermission(subsystem, partsName)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -2376,6 +2519,109 @@ export default {
|
|||||||
this.$set(this.pagination, 'total', 0)
|
this.$set(this.pagination, 'total', 0)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 获取审批流程数据
|
||||||
|
getApprovalSpet() {
|
||||||
|
if (!this.detail || !this.detail.flowId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const templateId = this.getDetailTemplateId()
|
||||||
|
if (!templateId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const request = {
|
||||||
|
...api.GET_PPROVAL_ALL,
|
||||||
|
params: {
|
||||||
|
flowId: this.detail.flowId,
|
||||||
|
templateId: templateId
|
||||||
|
},
|
||||||
|
disableSuccessMsg: true
|
||||||
|
}
|
||||||
|
this.$request(request)
|
||||||
|
.asyncThen((resp) => {
|
||||||
|
console.log('审批流程数据:', resp)
|
||||||
|
const data = resp.data || resp
|
||||||
|
// 保存流程详情
|
||||||
|
this.progressDetail = {
|
||||||
|
explanation: data.explanation || '',
|
||||||
|
flowStatus: data.flowStatus || '',
|
||||||
|
progressTitle: data.progressTitle || '',
|
||||||
|
templateVersion: data.templateVersion || '',
|
||||||
|
contentName: data.contentName || ''
|
||||||
|
}
|
||||||
|
// 保存流程节点
|
||||||
|
this.flowNodes = data.flowNodes || []
|
||||||
|
})
|
||||||
|
.asyncErrorCatch((err) => {
|
||||||
|
console.error('获取审批流程数据失败:', err)
|
||||||
|
this.flowNodes = []
|
||||||
|
this.progressDetail = {}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 设置状态文本
|
||||||
|
setStatusText(result) {
|
||||||
|
const statusMap = {
|
||||||
|
PASS: '通过',
|
||||||
|
REJECT: '拒绝',
|
||||||
|
REFUSE: '驳回',
|
||||||
|
APPROVE: '批准',
|
||||||
|
APPROVING: '审批中',
|
||||||
|
PENDING: '待处理',
|
||||||
|
WAITING: '待处理',
|
||||||
|
STAY: '待审批',
|
||||||
|
INITIATE: '发起审批'
|
||||||
|
}
|
||||||
|
return statusMap[result] || result || '待处理'
|
||||||
|
},
|
||||||
|
// 格式化时间
|
||||||
|
formatTime(time) {
|
||||||
|
if (!time) return '--'
|
||||||
|
// 如果是时间戳,转换为日期格式
|
||||||
|
if (typeof time === 'number') {
|
||||||
|
const date = new Date(time)
|
||||||
|
return date.toLocaleString('zh-CN', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
second: '2-digit'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 如果已经是字符串格式,直接返回
|
||||||
|
return time
|
||||||
|
},
|
||||||
|
// 获取时间线颜色
|
||||||
|
getTimelineColor(result, stepIndex, totalSteps) {
|
||||||
|
// 根据审批结果设置颜色
|
||||||
|
if (result === 'PASS' || result === 'APPROVE') {
|
||||||
|
return '#67C23A' // 绿色 - 通过
|
||||||
|
} else if (result === 'REJECT' || result === 'REFUSE') {
|
||||||
|
return '#F56C6C' // 红色 - 驳回
|
||||||
|
} else if (result === 'APPROVING' || result === 'PENDING' || result === 'WAITING') {
|
||||||
|
return '#E6A23C' // 橙色 - 审批中
|
||||||
|
} else if (result === 'STAY') {
|
||||||
|
return '#909399' // 灰色 - 待审批
|
||||||
|
} else if (result === 'INITIATE') {
|
||||||
|
return '#409EFF' // 蓝色 - 发起审批
|
||||||
|
}
|
||||||
|
// 默认颜色
|
||||||
|
return '#409EFF' // 默认蓝色
|
||||||
|
},
|
||||||
|
// 获取状态样式类
|
||||||
|
getStatusClass(result) {
|
||||||
|
const classMap = {
|
||||||
|
PASS: 'status-pass',
|
||||||
|
APPROVE: 'status-approve',
|
||||||
|
REJECT: 'status-reject',
|
||||||
|
REFUSE: 'status-reject',
|
||||||
|
APPROVING: 'status-approving',
|
||||||
|
PENDING: 'status-pending',
|
||||||
|
WAITING: 'status-pending',
|
||||||
|
STAY: 'status-default',
|
||||||
|
INITIATE: 'status-initiate'
|
||||||
|
}
|
||||||
|
return classMap[result] || 'status-default'
|
||||||
|
},
|
||||||
getVersionName(version) {
|
getVersionName(version) {
|
||||||
// 获取版本名称
|
// 获取版本名称
|
||||||
return version.version || version.name || ''
|
return version.version || version.name || ''
|
||||||
@ -3094,4 +3340,109 @@ export default {
|
|||||||
max-height: 400px;
|
max-height: 400px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 审批流程样式
|
||||||
|
.approval-progress-section {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.approval-timeline {
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-item-content {
|
||||||
|
.node-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-content {
|
||||||
|
.node-info {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
|
||||||
|
.node-user {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
|
||||||
|
.node-time {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-status {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
|
||||||
|
&.status-pass,
|
||||||
|
&.status-approve {
|
||||||
|
background-color: #f0f9ff;
|
||||||
|
color: #67c23a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-reject {
|
||||||
|
background-color: #fef0f0;
|
||||||
|
color: #f56c6c;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-approving {
|
||||||
|
background-color: #fdf6ec;
|
||||||
|
color: #e6a23c;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-pending {
|
||||||
|
background-color: #f4f4f5;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-default {
|
||||||
|
background-color: #f4f4f5;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-initiate {
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-opinion {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #606266;
|
||||||
|
margin-top: 8px;
|
||||||
|
padding: 8px;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-progress {
|
||||||
|
padding: 40px 0;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<template v-if="!showEngineDetail && !showEngineCheck && !showApprovalProgressDetail && !showReportDetail">
|
<template v-if="!showEngineDetail && !showEngineCheck && !showApprovalProgressDetail && !showReportDetail">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
我的待办
|
我的已办
|
||||||
</div>
|
</div>
|
||||||
<div class="operation">
|
<div class="operation">
|
||||||
<x-svg-icon
|
<x-svg-icon
|
||||||
@ -135,15 +135,14 @@
|
|||||||
return {
|
return {
|
||||||
rowDraggable: false,
|
rowDraggable: false,
|
||||||
colConfigs: [
|
colConfigs: [
|
||||||
{ prop: 'documentNo', label: '单据编号', showOverflowTooltip: true, minWidth: '140' },
|
// { prop: 'documentNo', label: '单据编号', showOverflowTooltip: true, minWidth: '140' },
|
||||||
{ prop: 'processTitle', label: '流程主题', showOverflowTooltip: true, minWidth: '160' },
|
{ prop: 'processTitle', label: '流程主题', showOverflowTooltip: true, minWidth: '160' },
|
||||||
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
|
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
|
||||||
// { prop: 'statusCode', label: '状态代号', showOverflowTooltip: true, minWidth: '120' },
|
// { prop: 'statusCode', label: '状态代号', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{ prop: 'modelName', label: '产品型号', showOverflowTooltip: true, minWidth: '120' },
|
// { prop: 'modelName', label: '产品型号', showOverflowTooltip: true, minWidth: '120' },
|
||||||
|
{ prop: 'currentProcessor', label: '当前处理人', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{ prop: 'createdBy', label: '创建人', showOverflowTooltip: true, minWidth: '120' },
|
{ prop: 'createdBy', label: '创建人', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{ prop: 'creationDate', label: '创建时间', showOverflowTooltip: true, minWidth: '160', align: 'center', formatter: this.formatDateTime },
|
{ prop: 'creationDate', label: '创建时间', showOverflowTooltip: true, minWidth: '160', align: 'center', formatter: this.formatDateTime },
|
||||||
{ prop: 'dataType', label: '数据类型', showOverflowTooltip: true, minWidth: '120' },
|
|
||||||
{ prop: 'versionNumber', label: '版本', showOverflowTooltip: true, minWidth: '100', align: 'center' },
|
|
||||||
{ prop: 'options', label: '操作', customSlot: 'options', align: 'center', width: '100', fixed: 'right' }
|
{ prop: 'options', label: '操作', customSlot: 'options', align: 'center', width: '100', fixed: 'right' }
|
||||||
],
|
],
|
||||||
seqType: '',
|
seqType: '',
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
>
|
>
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
我的待办
|
我的发起
|
||||||
</div>
|
</div>
|
||||||
<div class="operation">
|
<div class="operation">
|
||||||
<x-svg-icon
|
<x-svg-icon
|
||||||
@ -156,36 +156,15 @@ export default {
|
|||||||
return {
|
return {
|
||||||
rowDraggable: false,
|
rowDraggable: false,
|
||||||
colConfigs: [
|
colConfigs: [
|
||||||
{ prop: 'documentNo', label: '单据编号', showOverflowTooltip: true, minWidth: '140' },
|
// { prop: 'documentNo', label: '单据编号', showOverflowTooltip: true, minWidth: '140' },
|
||||||
{ prop: 'processTitle', label: '流程主题', showOverflowTooltip: true, minWidth: '160' },
|
{ prop: 'processTitle', label: '流程主题', showOverflowTooltip: true, minWidth: '160' },
|
||||||
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
|
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
|
||||||
// { prop: 'statusCode', label: '状态代号', showOverflowTooltip: true, minWidth: '120' },
|
// { prop: 'statusCode', label: '状态代号', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{ prop: 'modelName', label: '产品型号', showOverflowTooltip: true, minWidth: '120' },
|
// { prop: 'modelName', label: '产品型号', showOverflowTooltip: true, minWidth: '120' },
|
||||||
|
{ prop: 'currentProcessor', label: '当前处理人', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{ prop: 'createdBy', label: '创建人', showOverflowTooltip: true, minWidth: '120' },
|
{ prop: 'createdBy', label: '创建人', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{
|
{ prop: 'creationDate', label: '创建时间', showOverflowTooltip: true, minWidth: '160', align: 'center', formatter: this.formatDateTime },
|
||||||
prop: 'creationDate',
|
{ prop: 'options', label: '操作', customSlot: 'options', align: 'center', width: '100', fixed: 'right' }
|
||||||
label: '创建时间',
|
|
||||||
showOverflowTooltip: true,
|
|
||||||
minWidth: '160',
|
|
||||||
align: 'center',
|
|
||||||
formatter: this.formatDateTime
|
|
||||||
},
|
|
||||||
{ prop: 'dataType', label: '数据类型', showOverflowTooltip: true, minWidth: '120' },
|
|
||||||
{
|
|
||||||
prop: 'versionNumber',
|
|
||||||
label: '版本',
|
|
||||||
showOverflowTooltip: true,
|
|
||||||
minWidth: '100',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'options',
|
|
||||||
label: '操作',
|
|
||||||
customSlot: 'options',
|
|
||||||
align: 'center',
|
|
||||||
width: '100',
|
|
||||||
fixed: 'right'
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
seqType: '',
|
seqType: '',
|
||||||
seqConfig: {},
|
seqConfig: {},
|
||||||
|
|||||||
@ -107,18 +107,18 @@
|
|||||||
<span v-if="data.type === 'subsystem'" class="type-tag subsystem-tag">子系统</span>
|
<span v-if="data.type === 'subsystem'" class="type-tag subsystem-tag">子系统</span>
|
||||||
<span v-if="data.type === 'parameter'" class="type-tag parameter-tag">参数类型</span> -->
|
<span v-if="data.type === 'parameter'" class="type-tag parameter-tag">参数类型</span> -->
|
||||||
</span>
|
</span>
|
||||||
<span v-if="data.type === 'parameter'" class="permission-checkboxes">
|
<span v-if="data.type === 'subsystem' || data.type === 'parameter'" class="permission-checkboxes">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="data.permissions.view"
|
v-model="data.permissions.view"
|
||||||
size="small"
|
size="small"
|
||||||
@change="handlePermissionChange(data, 'view')"
|
@change="data.type === 'subsystem' ? handleSubsystemPermissionChange(data, 'view') : handlePermissionChange(data, 'view')"
|
||||||
>
|
>
|
||||||
查看
|
查看
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="data.permissions.edit"
|
v-model="data.permissions.edit"
|
||||||
size="small"
|
size="small"
|
||||||
@change="handlePermissionChange(data, 'edit')"
|
@change="data.type === 'subsystem' ? handleSubsystemPermissionChange(data, 'edit') : handlePermissionChange(data, 'edit')"
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
@ -525,9 +525,9 @@ export default {
|
|||||||
Object.keys(paramData).forEach((subsystemName) => {
|
Object.keys(paramData).forEach((subsystemName) => {
|
||||||
const partsArray = paramData[subsystemName]
|
const partsArray = paramData[subsystemName]
|
||||||
if (Array.isArray(partsArray)) {
|
if (Array.isArray(partsArray)) {
|
||||||
// 去重:使用Set去重,过滤掉空值和"/"
|
// 去重:使用Set去重,不过滤"/",只过滤空值
|
||||||
const uniqueParts = [...new Set(partsArray)].filter(
|
const uniqueParts = [...new Set(partsArray)].filter(
|
||||||
(part) => part && part !== '/' && part.trim() !== ''
|
(part) => part !== null && part !== undefined && part !== ''
|
||||||
)
|
)
|
||||||
processedMap[subsystemName] = uniqueParts
|
processedMap[subsystemName] = uniqueParts
|
||||||
} else {
|
} else {
|
||||||
@ -638,7 +638,8 @@ export default {
|
|||||||
const partsNodes = []
|
const partsNodes = []
|
||||||
const seenParts = new Set() // 用于去重(虽然接口返回已去重,但这里再加一层保险)
|
const seenParts = new Set() // 用于去重(虽然接口返回已去重,但这里再加一层保险)
|
||||||
partsNames.forEach((partsName, partsIdx) => {
|
partsNames.forEach((partsName, partsIdx) => {
|
||||||
if (!partsName || partsName === '/' || seenParts.has(partsName)) {
|
// 不过滤 `/`,只过滤空值和重复值
|
||||||
|
if (!partsName || seenParts.has(partsName)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
seenParts.add(partsName)
|
seenParts.add(partsName)
|
||||||
@ -677,7 +678,11 @@ export default {
|
|||||||
menuName: menuNode.label,
|
menuName: menuNode.label,
|
||||||
subsystem: subsystemName,
|
subsystem: subsystemName,
|
||||||
children: partsNodes, // 直接设置子节点,不再懒加载
|
children: partsNodes, // 直接设置子节点,不再懒加载
|
||||||
isLeaf: partsNodes.length === 0 // 如果没有partsName,标记为叶子节点
|
isLeaf: partsNodes.length === 0, // 如果没有partsName,标记为叶子节点
|
||||||
|
permissions: {
|
||||||
|
view: false,
|
||||||
|
edit: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subsystemNodes.push(subsystemNode)
|
subsystemNodes.push(subsystemNode)
|
||||||
@ -716,7 +721,8 @@ export default {
|
|||||||
const parameterNodes = []
|
const parameterNodes = []
|
||||||
const seenTypes = new Set() // 用于去重(虽然接口返回已去重,但这里再加一层保险)
|
const seenTypes = new Set() // 用于去重(虽然接口返回已去重,但这里再加一层保险)
|
||||||
partsNames.forEach((partsName, paramIdx) => {
|
partsNames.forEach((partsName, paramIdx) => {
|
||||||
if (!partsName || partsName === '/' || seenTypes.has(partsName)) {
|
// 不过滤 `/`,只过滤空值和重复值
|
||||||
|
if (!partsName || seenTypes.has(partsName)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
seenTypes.add(partsName)
|
seenTypes.add(partsName)
|
||||||
@ -759,7 +765,7 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 权限变更处理
|
// 权限变更处理(参数节点)
|
||||||
handlePermissionChange(data, permissionType) {
|
handlePermissionChange(data, permissionType) {
|
||||||
// 同步更新节点映射中的权限
|
// 同步更新节点映射中的权限
|
||||||
if (data.id && this.nodeMap[data.id]) {
|
if (data.id && this.nodeMap[data.id]) {
|
||||||
@ -770,6 +776,8 @@ export default {
|
|||||||
data.permissions[permissionType]
|
data.permissions[permissionType]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// 更新父节点(子系统)的权限状态
|
||||||
|
this.updateSubsystemPermissionFromChildren(data)
|
||||||
// 触发验证
|
// 触发验证
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.form) {
|
if (this.$refs.form) {
|
||||||
@ -777,6 +785,72 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 子系统权限变更处理(全选/取消全选子节点)
|
||||||
|
handleSubsystemPermissionChange(data, permissionType) {
|
||||||
|
// 同步更新节点映射中的权限
|
||||||
|
if (data.id && this.nodeMap[data.id]) {
|
||||||
|
// 使用 $set 确保响应式更新
|
||||||
|
this.$set(
|
||||||
|
this.nodeMap[data.id].permissions,
|
||||||
|
permissionType,
|
||||||
|
data.permissions[permissionType]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// 获取该子系统下的所有子节点(参数节点)
|
||||||
|
const children = data.children || []
|
||||||
|
const isChecked = data.permissions[permissionType]
|
||||||
|
// 全选/取消全选所有子节点
|
||||||
|
children.forEach((childNode) => {
|
||||||
|
if (childNode.id && this.nodeMap[childNode.id]) {
|
||||||
|
// 更新子节点的权限
|
||||||
|
this.$set(this.nodeMap[childNode.id].permissions, permissionType, isChecked)
|
||||||
|
// 同时更新子节点本身的权限(确保视图更新)
|
||||||
|
if (childNode.permissions) {
|
||||||
|
this.$set(childNode, 'permissions', {
|
||||||
|
...childNode.permissions,
|
||||||
|
[permissionType]: isChecked
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 触发验证
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.form) {
|
||||||
|
this.$refs.form.validateField('permissions')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 根据子节点权限更新子系统权限状态
|
||||||
|
updateSubsystemPermissionFromChildren(parameterNode) {
|
||||||
|
if (!parameterNode || !parameterNode.subsystem) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 查找该参数节点所属的子系统节点
|
||||||
|
const subsystemNode = Object.values(this.nodeMap).find(
|
||||||
|
(node) =>
|
||||||
|
node.type === 'subsystem' &&
|
||||||
|
node.subsystem === parameterNode.subsystem &&
|
||||||
|
node.menuName === parameterNode.menuName
|
||||||
|
)
|
||||||
|
if (!subsystemNode || !subsystemNode.children || subsystemNode.children.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 检查所有子节点的权限状态
|
||||||
|
const allChildren = subsystemNode.children
|
||||||
|
const allViewChecked = allChildren.every((child) => {
|
||||||
|
const childNode = this.nodeMap[child.id]
|
||||||
|
return childNode && childNode.permissions && childNode.permissions.view === true
|
||||||
|
})
|
||||||
|
const allEditChecked = allChildren.every((child) => {
|
||||||
|
const childNode = this.nodeMap[child.id]
|
||||||
|
return childNode && childNode.permissions && childNode.permissions.edit === true
|
||||||
|
})
|
||||||
|
// 更新子系统节点的权限状态
|
||||||
|
if (subsystemNode.permissions) {
|
||||||
|
this.$set(subsystemNode.permissions, 'view', allViewChecked)
|
||||||
|
this.$set(subsystemNode.permissions, 'edit', allEditChecked)
|
||||||
|
}
|
||||||
|
},
|
||||||
// 加载权限数据
|
// 加载权限数据
|
||||||
loadPermissionData() {
|
loadPermissionData() {
|
||||||
const request = {
|
const request = {
|
||||||
@ -1313,17 +1387,25 @@ export default {
|
|||||||
roleId: this.personConfigFormData.roleId,
|
roleId: this.personConfigFormData.roleId,
|
||||||
userOrDeptIds: userOrDeptId,
|
userOrDeptIds: userOrDeptId,
|
||||||
isDept: isDept
|
isDept: isDept
|
||||||
}
|
},
|
||||||
|
disableSuccessMsg: true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$request(request)
|
this.$request(request)
|
||||||
.asyncThen((resp) => {
|
.asyncThen((resp) => {
|
||||||
this.handlePersonConfigDialogClose()
|
this.handlePersonConfigDialogClose()
|
||||||
this.loadPermissionData()
|
this.loadPermissionData()
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '配置成功'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.asyncErrorCatch((err) => {
|
.asyncErrorCatch((err) => {
|
||||||
console.error('配置失败:', err)
|
console.error('配置失败:', err)
|
||||||
this.$message.error(err.message || '配置失败')
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: '配置失败'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.personConfigSubmitting = false
|
this.personConfigSubmitting = false
|
||||||
@ -1391,7 +1473,7 @@ export default {
|
|||||||
// 从数据设置权限
|
// 从数据设置权限
|
||||||
setPermissionsFromData(permissions) {
|
setPermissionsFromData(permissions) {
|
||||||
// permissions 格式是数组,每个元素包含:
|
// permissions 格式是数组,每个元素包含:
|
||||||
// { id, menuPath, subsystem, parameterName, parameterId, parameterPer }
|
// { id, subsystem, partsName, parameterPer }
|
||||||
// parameterPer 是字符串:"查看" 或 "编辑"
|
// parameterPer 是字符串:"查看" 或 "编辑"
|
||||||
const permArray = Array.isArray(permissions) ? permissions : []
|
const permArray = Array.isArray(permissions) ? permissions : []
|
||||||
|
|
||||||
@ -1401,38 +1483,49 @@ export default {
|
|||||||
// 保存权限数据,用于懒加载模式下延迟应用
|
// 保存权限数据,用于懒加载模式下延迟应用
|
||||||
this.pendingPermissions = permArray
|
this.pendingPermissions = permArray
|
||||||
|
|
||||||
// 处理权限数据,提取第一级菜单名并转换权限类型
|
// 处理权限数据:按 subsystem 和 partsName 分组,合并同一节点的查看和编辑权限
|
||||||
const processedPerms = permArray.map((perm) => {
|
const permissionMap = new Map() // key: `${subsystem}-${partsName}`, value: { view: boolean, edit: boolean }
|
||||||
const menuName = this.extractMenuNameFromPath(perm.menuPath || '')
|
permArray.forEach((perm) => {
|
||||||
return {
|
const subsystem = perm.subsystem || ''
|
||||||
...perm,
|
const partsName = perm.partsName || ''
|
||||||
menuName: menuName, // 提取的第一级菜单名
|
const key = `${subsystem}-${partsName}`
|
||||||
view: perm.parameterPer === '查看',
|
|
||||||
edit: perm.parameterPer === '编辑'
|
if (!permissionMap.has(key)) {
|
||||||
|
permissionMap.set(key, {
|
||||||
|
subsystem: subsystem,
|
||||||
|
partsName: partsName,
|
||||||
|
view: false,
|
||||||
|
edit: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const permData = permissionMap.get(key)
|
||||||
|
if (perm.parameterPer === '查看') {
|
||||||
|
permData.view = true
|
||||||
|
} else if (perm.parameterPer === '编辑') {
|
||||||
|
permData.edit = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 根据 menuName、subsystem、parameterName 匹配节点并设置权限(只设置已加载的节点)
|
// 根据 subsystem 和 partsName 匹配节点并设置权限(只设置已加载的节点)
|
||||||
processedPerms.forEach((perm) => {
|
permissionMap.forEach((permData, key) => {
|
||||||
Object.keys(this.nodeMap).forEach((nodeId) => {
|
Object.keys(this.nodeMap).forEach((nodeId) => {
|
||||||
const node = this.nodeMap[nodeId]
|
const node = this.nodeMap[nodeId]
|
||||||
if (node && node.type === 'parameter') {
|
if (node && node.type === 'parameter') {
|
||||||
// 匹配第一级:menuPath 中包含第一级菜单名
|
// 匹配子系统
|
||||||
const menuMatch = perm.menuName && node.menuName && perm.menuName === node.menuName
|
|
||||||
// 匹配第二级:subsystem
|
|
||||||
const subsystemMatch =
|
const subsystemMatch =
|
||||||
perm.subsystem && node.subsystem && perm.subsystem === node.subsystem
|
permData.subsystem && node.subsystem && permData.subsystem === node.subsystem
|
||||||
// 匹配第三级:parameterName
|
// 匹配零部件名称(partsName)
|
||||||
const parameterNameMatch =
|
const partsNameMatch =
|
||||||
perm.parameterName &&
|
permData.partsName &&
|
||||||
(node.parameterName || node.label) &&
|
(node.partsName || node.parameterName || node.label) &&
|
||||||
perm.parameterName === (node.parameterName || node.label)
|
permData.partsName === (node.partsName || node.parameterName || node.label)
|
||||||
|
|
||||||
if (menuMatch && subsystemMatch && parameterNameMatch) {
|
if (subsystemMatch && partsNameMatch) {
|
||||||
// 使用 $set 确保响应式更新,直接替换整个权限对象
|
// 使用 $set 确保响应式更新,直接替换整个权限对象
|
||||||
const newPermissions = {
|
const newPermissions = {
|
||||||
view: perm.view || false,
|
view: permData.view || false,
|
||||||
edit: perm.edit || false
|
edit: permData.edit || false
|
||||||
}
|
}
|
||||||
this.$set(node, 'permissions', newPermissions)
|
this.$set(node, 'permissions', newPermissions)
|
||||||
console.log(
|
console.log(
|
||||||
@ -1440,9 +1533,8 @@ export default {
|
|||||||
node.id,
|
node.id,
|
||||||
node.label,
|
node.label,
|
||||||
{
|
{
|
||||||
menuName: node.menuName,
|
|
||||||
subsystem: node.subsystem,
|
subsystem: node.subsystem,
|
||||||
parameterName: node.parameterName || node.label
|
partsName: node.partsName || node.parameterName || node.label
|
||||||
},
|
},
|
||||||
newPermissions
|
newPermissions
|
||||||
)
|
)
|
||||||
@ -1451,11 +1543,35 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 设置完所有参数节点权限后,更新子系统节点的权限状态
|
||||||
|
this.$nextTick(() => {
|
||||||
|
Object.keys(this.nodeMap).forEach((nodeId) => {
|
||||||
|
const node = this.nodeMap[nodeId]
|
||||||
|
if (node && node.type === 'subsystem' && node.children && node.children.length > 0) {
|
||||||
|
// 检查所有子节点的权限状态
|
||||||
|
const allChildren = node.children
|
||||||
|
const allViewChecked = allChildren.every((child) => {
|
||||||
|
const childNode = this.nodeMap[child.id]
|
||||||
|
return childNode && childNode.permissions && childNode.permissions.view === true
|
||||||
|
})
|
||||||
|
const allEditChecked = allChildren.every((child) => {
|
||||||
|
const childNode = this.nodeMap[child.id]
|
||||||
|
return childNode && childNode.permissions && childNode.permissions.edit === true
|
||||||
|
})
|
||||||
|
// 更新子系统节点的权限状态
|
||||||
|
if (node.permissions) {
|
||||||
|
this.$set(node.permissions, 'view', allViewChecked)
|
||||||
|
this.$set(node.permissions, 'edit', allEditChecked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
'权限数据已保存,待应用权限数量:',
|
'权限数据已保存,待应用权限数量:',
|
||||||
this.pendingPermissions.length,
|
this.pendingPermissions.length,
|
||||||
'处理后的权限:',
|
'处理后的权限映射:',
|
||||||
processedPerms
|
Array.from(permissionMap.entries())
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
// 将待应用的权限应用到新加载的节点
|
// 将待应用的权限应用到新加载的节点
|
||||||
@ -1469,21 +1585,17 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查找匹配的权限数据
|
// 查找匹配的权限数据:根据 subsystem 和 partsName 匹配
|
||||||
const matchingPerms = this.pendingPermissions.filter((perm) => {
|
const matchingPerms = this.pendingPermissions.filter((perm) => {
|
||||||
// 从 menuPath 中提取第一级菜单名
|
// 匹配子系统
|
||||||
const permMenuName = this.extractMenuNameFromPath(perm.menuPath || '')
|
|
||||||
// 匹配第一级:menuPath 中包含第一级菜单名
|
|
||||||
const menuMatch = permMenuName && node.menuName && permMenuName === node.menuName
|
|
||||||
// 匹配第二级:subsystem
|
|
||||||
const subsystemMatch = perm.subsystem && node.subsystem && perm.subsystem === node.subsystem
|
const subsystemMatch = perm.subsystem && node.subsystem && perm.subsystem === node.subsystem
|
||||||
// 匹配第三级:parameterName
|
// 匹配零部件名称(partsName)
|
||||||
const parameterNameMatch =
|
const partsNameMatch =
|
||||||
perm.parameterName &&
|
perm.partsName &&
|
||||||
(node.parameterName || node.label) &&
|
(node.partsName || node.parameterName || node.label) &&
|
||||||
perm.parameterName === (node.parameterName || node.label)
|
perm.partsName === (node.partsName || node.parameterName || node.label)
|
||||||
|
|
||||||
return menuMatch && subsystemMatch && parameterNameMatch
|
return subsystemMatch && partsNameMatch
|
||||||
})
|
})
|
||||||
|
|
||||||
if (matchingPerms.length > 0) {
|
if (matchingPerms.length > 0) {
|
||||||
@ -1528,6 +1640,11 @@ export default {
|
|||||||
'匹配的权限:',
|
'匹配的权限:',
|
||||||
matchingPerms
|
matchingPerms
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 应用权限后,更新父节点(子系统)的权限状态
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.updateSubsystemPermissionFromChildren(node)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 收集选中的权限
|
// 收集选中的权限
|
||||||
@ -1542,23 +1659,27 @@ export default {
|
|||||||
if (node && node.type === 'parameter') {
|
if (node && node.type === 'parameter') {
|
||||||
// 确保权限对象存在
|
// 确保权限对象存在
|
||||||
const nodePermissions = node.permissions || { view: false, edit: false }
|
const nodePermissions = node.permissions || { view: false, edit: false }
|
||||||
|
// 获取子系统名称和partsName
|
||||||
|
const subsystem = node.subsystem || ''
|
||||||
|
const partsName = node.partsName || node.parameterName || node.label || ''
|
||||||
|
|
||||||
// 如果选中了查看权限,添加一条记录(parameterPer = 1)
|
// 如果选中了查看权限,添加一条记录(parameterPer = 1)
|
||||||
if (nodePermissions.view) {
|
if (nodePermissions.view) {
|
||||||
permissions.push({
|
permissions.push({
|
||||||
roleId: roleId,
|
roleId: roleId,
|
||||||
menuName: node.menuName || '',
|
subsystem: subsystem,
|
||||||
parameterId: node.parameterId || '',
|
partsName: partsName,
|
||||||
parameterPer: 1, // 1是查看
|
parameterPer: 1, // 1是查看
|
||||||
userId: userId
|
userId: userId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 如果选中了控制权限,添加一条记录(parameterPer = 2)
|
// 如果选中了编辑权限,添加一条记录(parameterPer = 2)
|
||||||
if (nodePermissions.edit) {
|
if (nodePermissions.edit) {
|
||||||
permissions.push({
|
permissions.push({
|
||||||
roleId: roleId,
|
roleId: roleId,
|
||||||
menuName: node.menuName || '',
|
subsystem: subsystem,
|
||||||
parameterId: node.parameterId || '',
|
partsName: partsName,
|
||||||
parameterPer: 2, // 2是控制
|
parameterPer: 2, // 2是编辑
|
||||||
userId: userId
|
userId: userId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -837,16 +837,16 @@ export default {
|
|||||||
this.$message.error('缺少报告ID')
|
this.$message.error('缺少报告ID')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const nodeList = this.launchWorkflowSteps.map((step, index) => ({
|
||||||
|
nodeName: step.name,
|
||||||
|
assignees: step.handlers,
|
||||||
|
nodeOrder: index + 1
|
||||||
|
}))
|
||||||
// 构建提交数据
|
// 构建提交数据
|
||||||
const submitData = {
|
const submitData = {
|
||||||
reportId: reportId,
|
reportId: reportId,
|
||||||
userId: getUserId(),
|
userId: getUserId(),
|
||||||
processTitle: processTitle,
|
nodeList: nodeList
|
||||||
proofreadUsers: this.launchWorkflowSteps[0].handlers,
|
|
||||||
reviewUsers: this.launchWorkflowSteps[1].handlers,
|
|
||||||
countersignUsers: [],
|
|
||||||
approveUsers: this.launchWorkflowSteps[2].handlers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.launching = true
|
this.launching = true
|
||||||
|
|||||||
@ -260,7 +260,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>
|
||||||
@ -428,7 +428,9 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
reportDetail: {},
|
reportDetail: {},
|
||||||
progress: [],
|
progress: [], // 保留用于兼容
|
||||||
|
flowNodes: [], // 审批流程节点数据
|
||||||
|
progressDetail: {}, // 审批流程详情数据
|
||||||
approvalDialogVisible: false,
|
approvalDialogVisible: false,
|
||||||
approvalFormData: {
|
approvalFormData: {
|
||||||
result: '',
|
result: '',
|
||||||
@ -509,22 +511,92 @@ export default {
|
|||||||
nodes.push({
|
nodes.push({
|
||||||
title: '提交申请',
|
title: '提交申请',
|
||||||
userName: this.initiateNode.userName,
|
userName: this.initiateNode.userName,
|
||||||
time: this.initiateNode.uploadTime,
|
operateTime: this.initiateNode.uploadTime,
|
||||||
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
|
||||||
@ -655,75 +727,40 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getApprovalSpet(flowId) {
|
getApprovalSpet(flowId) {
|
||||||
|
if (!flowId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const reportId = this.reportDetail.reportId || this.reportDetail.id || this.detail.reportId || this.detail.id
|
||||||
|
if (!reportId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const request = {
|
const request = {
|
||||||
...api.GET_REPORT_DETAIL_PROCESS,
|
...api.GET_PPROVAL_ALL,
|
||||||
params: {
|
params: {
|
||||||
flowId: flowId
|
flowId: flowId,
|
||||||
|
templateId: reportId // 报告ID作为templateId参数
|
||||||
},
|
},
|
||||||
disableSuccessMsg: true
|
disableSuccessMsg: true
|
||||||
}
|
}
|
||||||
this.$request(request).asyncThen((resp) => {
|
this.$request(request)
|
||||||
|
.asyncThen((resp) => {
|
||||||
console.log('审批流程数据:', resp)
|
console.log('审批流程数据:', resp)
|
||||||
|
|
||||||
let list = []
|
|
||||||
const data = resp.data || resp
|
const data = resp.data || resp
|
||||||
|
// 保存流程详情
|
||||||
// 处理校对节点
|
this.progressDetail = {
|
||||||
if (data.proofreadNodes && Array.isArray(data.proofreadNodes) && data.proofreadNodes.length > 0) {
|
explanation: data.explanation || '',
|
||||||
const steps = data.proofreadNodes
|
flowStatus: data.flowStatus || '',
|
||||||
list.push({
|
progressTitle: data.progressTitle || '',
|
||||||
title: '校对',
|
templateVersion: data.templateVersion || '',
|
||||||
steps: this.deduplicateSteps(Array.isArray(steps) ? steps : [steps])
|
contentName: data.contentName || ''
|
||||||
|
}
|
||||||
|
// 保存流程节点
|
||||||
|
this.flowNodes = data.flowNodes || []
|
||||||
})
|
})
|
||||||
}
|
.asyncErrorCatch((err) => {
|
||||||
// 处理审核节点
|
console.error('获取审批流程数据失败:', err)
|
||||||
if (data.reviewNodes && Array.isArray(data.reviewNodes) && data.reviewNodes.length > 0) {
|
this.flowNodes = []
|
||||||
const steps = data.reviewNodes
|
this.progressDetail = {}
|
||||||
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)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleBack() {
|
handleBack() {
|
||||||
|
|||||||
@ -140,7 +140,7 @@ export default {
|
|||||||
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
|
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
|
||||||
// { prop: 'statusCode', label: '状态代号', showOverflowTooltip: true, minWidth: '120' },
|
// { prop: 'statusCode', label: '状态代号', showOverflowTooltip: true, minWidth: '120' },
|
||||||
// { prop: 'modelName', label: '产品型号', showOverflowTooltip: true, minWidth: '120' },
|
// { prop: 'modelName', label: '产品型号', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{ prop: 'partsName', label: '当前处理人', showOverflowTooltip: true, minWidth: '120' },
|
{ prop: 'currentProcessor', label: '当前处理人', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{ prop: 'createdBy', label: '创建人', showOverflowTooltip: true, minWidth: '120' },
|
{ prop: 'createdBy', label: '创建人', showOverflowTooltip: true, minWidth: '120' },
|
||||||
{ prop: 'creationDate', label: '创建时间', showOverflowTooltip: true, minWidth: '160', align: 'center', formatter: this.formatDateTime },
|
{ prop: 'creationDate', label: '创建时间', showOverflowTooltip: true, minWidth: '160', align: 'center', formatter: this.formatDateTime },
|
||||||
{ prop: 'options', label: '操作', customSlot: 'options', align: 'center', width: '100', fixed: 'right' }
|
{ prop: 'options', label: '操作', customSlot: 'options', align: 'center', width: '100', fixed: 'right' }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user