fix:修改bug

This commit is contained in:
大黑 2025-12-25 09:34:31 +08:00
parent f765a9fb61
commit 82499cf1fa
14 changed files with 2851 additions and 1558 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

@ -41,15 +41,15 @@
<div class="info-grid">
<div class="info-item">
<span class="label">流程主题</span>
<span class="value">{{ progressDetail.modelName || '--' }}</span>
<span class="value">{{ progressDetail.progressTitle || '--' }}</span>
</div>
<div class="info-item">
<span class="label">模板名称</span>
<span class="value">{{ progressDetail.applicant || '--' }}</span>
<span class="value">{{ progressDetail.contentName || '--' }}</span>
</div>
<div class="info-item">
<span class="label">版本</span>
<span class="value">{{ progressDetail.submitTime || '--' }}</span>
<span class="value">{{ progressDetail.templateVersion || '--' }}</span>
</div>
</div>
</section>
@ -731,7 +731,7 @@ export default {
.info-grid {
display: grid;
grid-template-columns: repeat(2, minmax(200px, 1fr));
grid-template-columns: repeat(3, minmax(200px, 1fr));
gap: 16px 24px;
.info-item {

View File

@ -22,7 +22,12 @@
<el-button size="small" @click="handleReject">
退回
</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>
</div>
@ -51,12 +56,7 @@
<div class="section-title">
审批内容
</div>
<el-table
:data="changeTable || []"
border
class="change-table"
:max-height="500"
>
<el-table :data="changeTable || []" border class="change-table" :max-height="500">
<el-table-column label="序号" type="index" width="60" />
<el-table-column
prop="subsystemName"
@ -84,12 +84,7 @@
/>
<el-table-column prop="parameterValue" label="参数值" min-width="160">
</el-table-column>
<el-table-column
prop="unit"
label="单位"
min-width="80"
show-overflow-tooltip
/>
<el-table-column prop="unit" label="单位" min-width="80" show-overflow-tooltip />
<el-table-column prop="changeComment" label="修改描述" min-width="160">
</el-table-column>
</el-table>
@ -299,22 +294,24 @@ export default {
let status = 'APPROVING'
if (record.operate) {
const operate = String(record.operate).toUpperCase()
if (operate === 'REJECT') {
if (record.operate === 'REJECT') {
result = 'REJECT'
status = 'REJECT'
} else if (operate === 'APPROVING') {
} else if (record.operate === 'APPROVING') {
result = 'APPROVING'
status = 'APPROVING'
} else if (operate === 'PASS') {
} else if (record.operate === 'PASS') {
result = 'PASS'
status = 'PASS'
} else if (record.operate === '待审批') {
result = 'STAY'
status = 'STAY'
}
}
nodes.push({
title: record.node || '审批节点',
userName: record.approverPersons || '--',
userName: record.unapprovedPerson || '--',
operateTime: record.approvalTime || record.handleTime || record.createTime || '',
result: result,
status: status,
@ -328,7 +325,7 @@ export default {
stage.steps.forEach((step) => {
nodes.push({
title: '审批节点',
userName: step.approverPersons,
userName: step.unapprovedPerson,
time: step.approvalTime || step.handleTime || step.createTime,
result: step.result || step.status,
status: step.result || step.status,
@ -371,7 +368,6 @@ export default {
console.error('获取审批变更失败:', err)
})
},
getApprovalDetail() {
const request = {
...api.GET_ENGINE_CHECK_DETAIL,
@ -389,12 +385,14 @@ export default {
// { list: [], total: 0 }
if (resp.data.list && Array.isArray(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) {
// 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)) {
//
allData = resp.data
@ -415,11 +413,36 @@ export default {
// nodeOrder
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 orderB = b.nodeOrder !== undefined && b.nodeOrder !== null ? Number(b.nodeOrder) : 0
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 = []
return
}
//
const startIndex = (this.changeTablePageNumber - 1) * this.changeTablePageSize
const endIndex = startIndex + this.changeTablePageSize
//
this.changeTable = this.changeTableAll.slice(startIndex, endIndex)
},
@ -445,6 +466,7 @@ export default {
APPROVING: '审批中',
PENDING: '待处理',
WAITING: '待处理',
STAY: '待审批',
INITIATE: '发起审批'
}
return statusMap[result] || result || '待处理'
@ -474,6 +496,8 @@ export default {
return '#F56C6C' // -
} else if (result === 'APPROVING' || result === 'PENDING' || result === 'WAITING') {
return '#E6A23C' // -
} else if (result === 'STAY') {
return '#909399' // -
} else if (result === 'INITIATE') {
return '#409EFF' // -
}
@ -489,6 +513,7 @@ export default {
APPROVING: 'status-approving',
PENDING: 'status-pending',
WAITING: 'status-pending',
STAY: 'status-default',
INITIATE: 'status-initiate'
}
return classMap[result] || 'status-default'
@ -509,7 +534,6 @@ export default {
let list = []
const data = resp.data || resp
//
if (
data.proofreadNodes &&
@ -577,7 +601,6 @@ export default {
}))
}
}
this.progress = list
console.log('处理后的流程数据:', this.progress)
})
@ -621,18 +644,15 @@ export default {
if (!valid) {
return false
}
if (!this.detail || !this.detail.id) {
this.$message.error('缺少审批数据')
return
}
const approvalId = this.detail.id
if (!approvalId) {
this.$message.error('缺少审批ID无法提交审批')
return
}
//
// operator退 'REJECT' 'PASS'
const operator = this.approvalActionType === 'reject' ? 'REJECT' : 'PASS'

View File

@ -325,7 +325,7 @@ export default {
}
},
mounted() {
// this.loadUserSelfRole()
this.loadUserSelfRole()
this.loadTemplateOptions()
this.loadData()
},

View File

@ -19,7 +19,7 @@
</el-button>
<div class="header-item">
<span class="label">{{ isApprovalMode ? '发起审批' : '模板名称' }}:</span>
<span class="value">{{
<span class="value" v-if="!isApprovalMode">{{
isApprovalMode ? '系统参数模板' : displayTemplateName || '系统参数'
}}</span>
</div>
@ -158,6 +158,47 @@
</div>
</template>
</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>
<!-- 审批内容区域 -->
@ -595,7 +636,10 @@ export default {
checkStrictly: true, //
emitPath: false, // id
multiple: false //
}
},
//
flowNodes: [], //
progressDetail: {} //
}
},
computed: {
@ -858,6 +902,84 @@ export default {
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() {
if (!this.departmentSearchText || this.departmentSearchText.trim() === '') {
@ -972,6 +1094,12 @@ export default {
// detail versionList
this.updateCurrentStatus()
}
// flowId
if (newDetail && newDetail.flowId) {
this.$nextTick(() => {
this.getApprovalSpet()
})
}
},
immediate: true,
deep: true
@ -1004,6 +1132,10 @@ export default {
},
mounted() {
this.loadDepartmentList()
// flowId
if (this.detail && this.detail.flowId) {
this.getApprovalSpet()
}
},
methods: {
//
@ -1085,9 +1217,9 @@ export default {
const checkSubsystem = subsystem || this.displayTemplateName
return this.checkPermission('模板管理', checkSubsystem, '编辑')
},
// parameterName
hasParameterEditPermission(parameterName) {
if (!parameterName) {
// subsystempartsName
hasParameterEditPermission(subsystem, partsName) {
if (!subsystem || !partsName) {
return false
}
// 使
@ -1099,8 +1231,13 @@ export default {
return false
}
// parameterName
if (perm.parameterName !== parameterName) {
// subsystem
if (perm.subsystem !== subsystem) {
return false
}
// partsName
if (perm.partsName !== partsName) {
return false
}
@ -1121,7 +1258,7 @@ export default {
return false
}
// menuPath""subsystemtemplateNameparameterNameparameterPer""
// menuPath""subsystempartsNameparameterPer""
const templateName = this.displayTemplateName
const matchedPermissions = permissionData.filter((perm) => {
// menuPath
@ -1130,13 +1267,18 @@ export default {
return false
}
// subsystem templateName
// subsystem templateName templateName
if (templateName && perm.subsystem !== templateName) {
return false
}
// parameterName
if (perm.parameterName !== parameterName) {
// subsystem
if (perm.subsystem !== subsystem) {
return false
}
// partsName
if (perm.partsName !== partsName) {
return false
}
@ -1159,9 +1301,10 @@ export default {
if (row.createdBy === getUserId()) {
return true
}
// ""/
const parameterName = row.parameterName
if (parameterName && this.hasParameterEditPermission(parameterName)) {
//
const subsystem = row.subsystemName || row.subsystem || ''
const partsName = row.partsName || ''
if (subsystem && partsName && this.hasParameterEditPermission(subsystem, partsName)) {
return true
}
return false
@ -2376,6 +2519,109 @@ export default {
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) {
//
return version.version || version.name || ''
@ -3094,4 +3340,109 @@ export default {
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>

View File

@ -3,7 +3,7 @@
<template v-if="!showEngineDetail && !showEngineCheck && !showApprovalProgressDetail && !showReportDetail">
<div class="page-header">
<div class="title">
我的
我的
</div>
<div class="operation">
<x-svg-icon
@ -135,15 +135,14 @@
return {
rowDraggable: false,
colConfigs: [
{ prop: 'documentNo', label: '单据编号', showOverflowTooltip: true, minWidth: '140' },
// { prop: 'documentNo', label: '', showOverflowTooltip: true, minWidth: '140' },
{ prop: 'processTitle', label: '流程主题', showOverflowTooltip: true, minWidth: '160' },
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
// { 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: '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' }
],
seqType: '',

View File

@ -7,7 +7,7 @@
>
<div class="page-header">
<div class="title">
我的待办
我的发起
</div>
<div class="operation">
<x-svg-icon
@ -156,36 +156,15 @@ export default {
return {
rowDraggable: false,
colConfigs: [
{ prop: 'documentNo', label: '单据编号', showOverflowTooltip: true, minWidth: '140' },
// { prop: 'documentNo', label: '', showOverflowTooltip: true, minWidth: '140' },
{ prop: 'processTitle', label: '流程主题', showOverflowTooltip: true, minWidth: '160' },
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
// { 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: '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: 'creationDate', label: '创建时间', showOverflowTooltip: true, minWidth: '160', align: 'center', formatter: this.formatDateTime },
{ prop: 'options', label: '操作', customSlot: 'options', align: 'center', width: '100', fixed: 'right' }
],
seqType: '',
seqConfig: {},

View File

@ -107,18 +107,18 @@
<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>
<span v-if="data.type === 'parameter'" class="permission-checkboxes">
<span v-if="data.type === 'subsystem' || data.type === 'parameter'" class="permission-checkboxes">
<el-checkbox
v-model="data.permissions.view"
size="small"
@change="handlePermissionChange(data, 'view')"
@change="data.type === 'subsystem' ? handleSubsystemPermissionChange(data, 'view') : handlePermissionChange(data, 'view')"
>
查看
</el-checkbox>
<el-checkbox
v-model="data.permissions.edit"
size="small"
@change="handlePermissionChange(data, 'edit')"
@change="data.type === 'subsystem' ? handleSubsystemPermissionChange(data, 'edit') : handlePermissionChange(data, 'edit')"
>
编辑
</el-checkbox>
@ -525,9 +525,9 @@ export default {
Object.keys(paramData).forEach((subsystemName) => {
const partsArray = paramData[subsystemName]
if (Array.isArray(partsArray)) {
// 使Set"/"
// 使Set"/"
const uniqueParts = [...new Set(partsArray)].filter(
(part) => part && part !== '/' && part.trim() !== ''
(part) => part !== null && part !== undefined && part !== ''
)
processedMap[subsystemName] = uniqueParts
} else {
@ -638,7 +638,8 @@ export default {
const partsNodes = []
const seenParts = new Set() //
partsNames.forEach((partsName, partsIdx) => {
if (!partsName || partsName === '/' || seenParts.has(partsName)) {
// `/`
if (!partsName || seenParts.has(partsName)) {
return
}
seenParts.add(partsName)
@ -677,7 +678,11 @@ export default {
menuName: menuNode.label,
subsystem: subsystemName,
children: partsNodes, //
isLeaf: partsNodes.length === 0 // partsName
isLeaf: partsNodes.length === 0, // partsName
permissions: {
view: false,
edit: false
}
}
subsystemNodes.push(subsystemNode)
@ -716,7 +721,8 @@ export default {
const parameterNodes = []
const seenTypes = new Set() //
partsNames.forEach((partsName, paramIdx) => {
if (!partsName || partsName === '/' || seenTypes.has(partsName)) {
// `/`
if (!partsName || seenTypes.has(partsName)) {
return
}
seenTypes.add(partsName)
@ -759,7 +765,7 @@ export default {
})
})
},
//
//
handlePermissionChange(data, permissionType) {
//
if (data.id && this.nodeMap[data.id]) {
@ -770,6 +776,8 @@ export default {
data.permissions[permissionType]
)
}
//
this.updateSubsystemPermissionFromChildren(data)
//
this.$nextTick(() => {
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() {
const request = {
@ -1313,17 +1387,25 @@ export default {
roleId: this.personConfigFormData.roleId,
userOrDeptIds: userOrDeptId,
isDept: isDept
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
this.handlePersonConfigDialogClose()
this.loadPermissionData()
this.$message({
type: 'success',
message: '配置成功'
})
})
.asyncErrorCatch((err) => {
console.error('配置失败:', err)
this.$message.error(err.message || '配置失败')
this.$message({
type: 'error',
message: '配置失败'
})
})
.finally(() => {
this.personConfigSubmitting = false
@ -1391,7 +1473,7 @@ export default {
//
setPermissionsFromData(permissions) {
// permissions
// { id, menuPath, subsystem, parameterName, parameterId, parameterPer }
// { id, subsystem, partsName, parameterPer }
// parameterPer "" ""
const permArray = Array.isArray(permissions) ? permissions : []
@ -1401,38 +1483,49 @@ export default {
//
this.pendingPermissions = permArray
//
const processedPerms = permArray.map((perm) => {
const menuName = this.extractMenuNameFromPath(perm.menuPath || '')
return {
...perm,
menuName: menuName, //
view: perm.parameterPer === '查看',
edit: perm.parameterPer === '编辑'
// subsystem partsName
const permissionMap = new Map() // key: `${subsystem}-${partsName}`, value: { view: boolean, edit: boolean }
permArray.forEach((perm) => {
const subsystem = perm.subsystem || ''
const partsName = perm.partsName || ''
const key = `${subsystem}-${partsName}`
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
}
})
// menuNamesubsystemparameterName
processedPerms.forEach((perm) => {
// subsystem partsName
permissionMap.forEach((permData, key) => {
Object.keys(this.nodeMap).forEach((nodeId) => {
const node = this.nodeMap[nodeId]
if (node && node.type === 'parameter') {
// menuPath
const menuMatch = perm.menuName && node.menuName && perm.menuName === node.menuName
// subsystem
//
const subsystemMatch =
perm.subsystem && node.subsystem && perm.subsystem === node.subsystem
// parameterName
const parameterNameMatch =
perm.parameterName &&
(node.parameterName || node.label) &&
perm.parameterName === (node.parameterName || node.label)
permData.subsystem && node.subsystem && permData.subsystem === node.subsystem
// partsName
const partsNameMatch =
permData.partsName &&
(node.partsName || node.parameterName || node.label) &&
permData.partsName === (node.partsName || node.parameterName || node.label)
if (menuMatch && subsystemMatch && parameterNameMatch) {
if (subsystemMatch && partsNameMatch) {
// 使 $set
const newPermissions = {
view: perm.view || false,
edit: perm.edit || false
view: permData.view || false,
edit: permData.edit || false
}
this.$set(node, 'permissions', newPermissions)
console.log(
@ -1440,9 +1533,8 @@ export default {
node.id,
node.label,
{
menuName: node.menuName,
subsystem: node.subsystem,
parameterName: node.parameterName || node.label
partsName: node.partsName || node.parameterName || node.label
},
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(
'权限数据已保存,待应用权限数量:',
this.pendingPermissions.length,
'处理后的权限:',
processedPerms
'处理后的权限映射:',
Array.from(permissionMap.entries())
)
},
//
@ -1469,21 +1585,17 @@ export default {
return
}
//
// subsystem partsName
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
// parameterName
const parameterNameMatch =
perm.parameterName &&
(node.parameterName || node.label) &&
perm.parameterName === (node.parameterName || node.label)
// partsName
const partsNameMatch =
perm.partsName &&
(node.partsName || node.parameterName || node.label) &&
perm.partsName === (node.partsName || node.parameterName || node.label)
return menuMatch && subsystemMatch && parameterNameMatch
return subsystemMatch && partsNameMatch
})
if (matchingPerms.length > 0) {
@ -1528,6 +1640,11 @@ export default {
'匹配的权限:',
matchingPerms
)
//
this.$nextTick(() => {
this.updateSubsystemPermissionFromChildren(node)
})
}
},
//
@ -1542,23 +1659,27 @@ export default {
if (node && node.type === 'parameter') {
//
const nodePermissions = node.permissions || { view: false, edit: false }
// partsName
const subsystem = node.subsystem || ''
const partsName = node.partsName || node.parameterName || node.label || ''
// parameterPer = 1
if (nodePermissions.view) {
permissions.push({
roleId: roleId,
menuName: node.menuName || '',
parameterId: node.parameterId || '',
subsystem: subsystem,
partsName: partsName,
parameterPer: 1, // 1
userId: userId
})
}
// parameterPer = 2
// parameterPer = 2
if (nodePermissions.edit) {
permissions.push({
roleId: roleId,
menuName: node.menuName || '',
parameterId: node.parameterId || '',
parameterPer: 2, // 2
subsystem: subsystem,
partsName: partsName,
parameterPer: 2, // 2
userId: userId
})
}

View File

@ -837,16 +837,16 @@ export default {
this.$message.error('缺少报告ID')
return
}
const nodeList = this.launchWorkflowSteps.map((step, index) => ({
nodeName: step.name,
assignees: step.handlers,
nodeOrder: index + 1
}))
//
const submitData = {
reportId: reportId,
userId: getUserId(),
processTitle: processTitle,
proofreadUsers: this.launchWorkflowSteps[0].handlers,
reviewUsers: this.launchWorkflowSteps[1].handlers,
countersignUsers: [],
approveUsers: this.launchWorkflowSteps[2].handlers
nodeList: nodeList
}
this.launching = true

View File

@ -260,7 +260,7 @@
<div class="node-user">
{{ node.userName || '--' }}
<span class="node-time">
{{ formatTime(node.time) }}
{{ formatTime(node.operateTime) }}
</span>
</div>
</div>
@ -428,7 +428,9 @@ export default {
data() {
return {
reportDetail: {},
progress: [],
progress: [], //
flowNodes: [], //
progressDetail: {}, //
approvalDialogVisible: false,
approvalFormData: {
result: '',
@ -509,22 +511,92 @@ export default {
nodes.push({
title: '提交申请',
userName: this.initiateNode.userName,
time: this.initiateNode.uploadTime,
operateTime: this.initiateNode.uploadTime,
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
@ -655,75 +727,40 @@ export default {
})
},
getApprovalSpet(flowId) {
if (!flowId) {
return
}
const reportId = this.reportDetail.reportId || this.reportDetail.id || this.detail.reportId || this.detail.id
if (!reportId) {
return
}
const request = {
...api.GET_REPORT_DETAIL_PROCESS,
...api.GET_PPROVAL_ALL,
params: {
flowId: flowId
flowId: flowId,
templateId: reportId // IDtemplateId
},
disableSuccessMsg: true
}
this.$request(request).asyncThen((resp) => {
this.$request(request)
.asyncThen((resp) => {
console.log('审批流程数据:', resp)
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])
//
this.progressDetail = {
explanation: data.explanation || '',
flowStatus: data.flowStatus || '',
progressTitle: data.progressTitle || '',
templateVersion: data.templateVersion || '',
contentName: data.contentName || ''
}
//
this.flowNodes = data.flowNodes || []
})
}
//
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.progressDetail = {}
})
},
handleBack() {

View File

@ -140,7 +140,7 @@ export default {
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
// { prop: 'statusCode', 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: 'creationDate', label: '创建时间', showOverflowTooltip: true, minWidth: '160', align: 'center', formatter: this.formatDateTime },
{ prop: 'options', label: '操作', customSlot: 'options', align: 'center', width: '100', fixed: 'right' }