feat:同步参数

This commit is contained in:
大黑 2026-02-03 13:52:28 +08:00
parent d002e3ff8c
commit 8636778f9d
6 changed files with 575 additions and 337 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

View File

@ -44,6 +44,10 @@ export default {
url: '/custom/engineParamDetailPojo/selectParamListAndModel', url: '/custom/engineParamDetailPojo/selectParamListAndModel',
method: 'get' method: 'get'
}, },
GET_NEW_MODEL_VERSION: {
url: '/custom/dataEntryEngineModel/synchronizeParams',
method: 'get'
},
CONTINUE_DATA_APPROVAL: { CONTINUE_DATA_APPROVAL: {
url: '/custom/activiti/continueApproval', url: '/custom/activiti/continueApproval',
method: 'get' method: 'get'

View File

@ -25,12 +25,24 @@
</div> </div>
<div v-if="!isApprovalMode && !hideOperations" class="operation"> <div v-if="!isApprovalMode && !hideOperations" class="operation">
<template v-if="isDispatchMode"> <template v-if="isDispatchMode">
<el-button v-if="shouldShowRejectButton" size="small" :loading="rejecting" @click="handleReject">拒绝</el-button> <el-button
v-if="shouldShowRejectButton"
size="small"
:loading="rejecting"
@click="handleReject"
>拒绝</el-button
>
<el-button size="small" @click="handleBatchModifyResponsible"> <el-button size="small" @click="handleBatchModifyResponsible">
{{ dispatchType === 'update_param' ? '批量修改填写人' : '批量修改责任人' }} {{ dispatchType === 'update_param' ? '批量修改填写人' : '批量修改责任人' }}
</el-button> </el-button>
<!-- <el-button size="small" @click="handleSave">保存</el-button> --> <!-- <el-button size="small" @click="handleSave">保存</el-button> -->
<el-button type="primary" size="small" :loading="dispatchLoading" @click="handleConfirmDispatch">确认分发</el-button> <el-button
type="primary"
size="small"
:loading="dispatchLoading"
@click="handleConfirmDispatch"
>确认分发</el-button
>
</template> </template>
<template v-else> <template v-else>
<!-- <el-select <!-- <el-select
@ -41,6 +53,9 @@
> >
<el-option v-for="ver in versions" :key="ver.id" :label="ver.label" :value="ver.id" /> <el-option v-for="ver in versions" :key="ver.id" :label="ver.label" :value="ver.id" />
</el-select> --> </el-select> -->
<el-button size="small" @click="handleSyncVersion">
同步参数版本
</el-button>
<el-button <el-button
v-if="!isEditMode && !isJustCheckMode" v-if="!isEditMode && !isJustCheckMode"
size="small" size="small"
@ -64,9 +79,22 @@
@change="handleFileChange" @change="handleFileChange"
/> />
<template v-if="!isEditMode && !isJustCheckMode"> <template v-if="!isEditMode && !isJustCheckMode">
<el-button v-if="hasAnyEditPermission()" size="small" @click="handleEdit">编辑</el-button> <el-button v-if="hasAnyEditPermission()" size="small" @click="handleEdit"
<el-button v-if="shouldShowRejectButton && !shouldShowResendButton" size="small" :loading="rejecting" @click="handleReject">拒绝</el-button> >编辑</el-button
<el-button v-if="shouldShowResendButton" size="small" :loading="resending" @click="handleResend"> >
<el-button
v-if="shouldShowRejectButton && !shouldShowResendButton"
size="small"
:loading="rejecting"
@click="handleReject"
>拒绝</el-button
>
<el-button
v-if="shouldShowResendButton"
size="small"
:loading="resending"
@click="handleResend"
>
直送 直送
</el-button> </el-button>
<el-button type="primary" size="small" @click="handleInitiateApproval"> <el-button type="primary" size="small" @click="handleInitiateApproval">
@ -161,13 +189,28 @@
<div class="section" v-if="shouldShowSection(sectionKey)" :key="sectionKey"> <div class="section" v-if="shouldShowSection(sectionKey)" :key="sectionKey">
<div class="section-title">{{ formatSectionTitle(sectionKey, sectionData) }}</div> <div class="section-title">{{ formatSectionTitle(sectionKey, sectionData) }}</div>
<div class="grid"> <div class="grid">
<div class="grid-header" :class="{ 'edit-mode': isEditMode && !isDispatchMode, 'dispatch-mode': isDispatchMode && dispatchType !== 'update_param', 'dispatch-filler-mode': isDispatchMode && dispatchType === 'update_param' }"> <div
class="grid-header"
:class="{
'edit-mode': isEditMode && !isDispatchMode,
'dispatch-mode': isDispatchMode && dispatchType !== 'update_param',
'dispatch-filler-mode': isDispatchMode && dispatchType === 'update_param'
}"
>
<div class="cell header-cell">参数名称</div> <div class="cell header-cell">参数名称</div>
<div class="cell header-cell">单位</div> <div class="cell header-cell">单位</div>
<div class="cell header-cell">参数值</div> <div class="cell header-cell">参数值</div>
<div class="cell header-cell" v-if="!isEditMode || isDispatchMode">填写部门</div> <div class="cell header-cell" v-if="!isEditMode || isDispatchMode">填写部门</div>
<div class="cell header-cell" v-if="isDispatchMode && dispatchType !== 'update_param'">分发状态</div> <div
<div class="cell header-cell" v-if="isDispatchMode && dispatchType === 'update_param'">分发状态</div> class="cell header-cell"
v-if="isDispatchMode && dispatchType !== 'update_param'"
>分发状态</div
>
<div
class="cell header-cell"
v-if="isDispatchMode && dispatchType === 'update_param'"
>分发状态</div
>
<div class="cell header-cell" v-if="!isEditMode || isDispatchMode"> <div class="cell header-cell" v-if="!isEditMode || isDispatchMode">
{{ {{
isDispatchMode && dispatchType === 'update_param' isDispatchMode && dispatchType === 'update_param'
@ -182,7 +225,11 @@
class="grid-row" class="grid-row"
v-for="(row, idx) in sectionData" v-for="(row, idx) in sectionData"
:key="sectionKey + '-' + idx" :key="sectionKey + '-' + idx"
:class="{ 'edit-mode': isEditMode && !isDispatchMode, 'dispatch-mode': isDispatchMode && dispatchType !== 'update_param', 'dispatch-filler-mode': isDispatchMode && dispatchType === 'update_param' }" :class="{
'edit-mode': isEditMode && !isDispatchMode,
'dispatch-mode': isDispatchMode && dispatchType !== 'update_param',
'dispatch-filler-mode': isDispatchMode && dispatchType === 'update_param'
}"
> >
<div class="cell">{{ row.parameterName }}</div> <div class="cell">{{ row.parameterName }}</div>
<div class="cell"> <div class="cell">
@ -196,7 +243,9 @@
placeholder="请输入" placeholder="请输入"
class="param-input" class="param-input"
/> />
<span v-else-if="!isEditMode && !isDispatchMode && filledBy">{{ row.minorVersion || row.parameterValue || '/' }}</span> <span v-else-if="!isEditMode && !isDispatchMode && filledBy">{{
row.minorVersion || row.parameterValue || '/'
}}</span>
<span v-else>{{ row.parameterValue || '/' }}</span> <span v-else>{{ row.parameterValue || '/' }}</span>
</div> </div>
<div v-if="!isEditMode || isDispatchMode" class="cell"> <div v-if="!isEditMode || isDispatchMode" class="cell">
@ -220,7 +269,9 @@
</div> </div>
<!-- 填写人列分发模式下且是 update_param 类型时显示已分发的显示名称未分发的可编辑 --> <!-- 填写人列分发模式下且是 update_param 类型时显示已分发的显示名称未分发的可编辑 -->
<div v-if="isDispatchMode && dispatchType === 'update_param'" class="cell"> <div v-if="isDispatchMode && dispatchType === 'update_param'" class="cell">
<span v-if="row.isDistributedFilled === 1">{{ row.filledByName || row.filledBy || '-' }}</span> <span v-if="row.isDistributedFilled === 1">{{
row.filledByName || row.filledBy || '-'
}}</span>
<el-select <el-select
v-else v-else
v-model="row.filledByUserId" v-model="row.filledByUserId"
@ -608,7 +659,13 @@ export default {
// //
canSwitchVersion() { canSwitchVersion() {
// //
return !this.hideOperations && !this.isDispatchMode && !this.fromTodo && !this.filledBy && !this.isEditMode return (
!this.hideOperations &&
!this.isDispatchMode &&
!this.fromTodo &&
!this.filledBy &&
!this.isEditMode
)
}, },
// justCheck // justCheck
isJustCheckMode() { isJustCheckMode() {
@ -667,7 +724,8 @@ export default {
contentName: this.progressDetailData.contentName || '', contentName: this.progressDetailData.contentName || '',
templateVersion: this.progressDetailData.templateVersion || '', templateVersion: this.progressDetailData.templateVersion || '',
explanation: this.progressDetailData.explanation || '', explanation: this.progressDetailData.explanation || '',
description: this.progressDetailData.explanation || this.progressDetailData.description || '' description:
this.progressDetailData.explanation || this.progressDetailData.description || ''
} }
} }
return { return {
@ -682,15 +740,15 @@ export default {
currentNode() { currentNode() {
if (this.flowNodes && this.flowNodes.length > 0) { if (this.flowNodes && this.flowNodes.length > 0) {
// """" // """"
const approvingNode = this.flowNodes.find((node) => const approvingNode = this.flowNodes.find(
node.result === '待审批' || node.result === 'APPROVING' (node) => node.result === '待审批' || node.result === 'APPROVING'
) )
if (approvingNode) { if (approvingNode) {
return approvingNode.node || '--' return approvingNode.node || '--'
} }
// //
const lastNode = this.flowNodes[this.flowNodes.length - 1] const lastNode = this.flowNodes[this.flowNodes.length - 1]
return lastNode ? (lastNode.node || '--') : '--' return lastNode ? lastNode.node || '--' : '--'
} }
return '--' return '--'
}, },
@ -698,8 +756,8 @@ export default {
currentProcessor() { currentProcessor() {
if (this.flowNodes && this.flowNodes.length > 0) { if (this.flowNodes && this.flowNodes.length > 0) {
// """" // """"
const approvingNode = this.flowNodes.find((node) => const approvingNode = this.flowNodes.find(
node.result === '待审批' || node.result === 'APPROVING' (node) => node.result === '待审批' || node.result === 'APPROVING'
) )
if (approvingNode) { if (approvingNode) {
// 使使 // 使使
@ -880,13 +938,7 @@ export default {
// //
this.getversions() this.getversions()
// //
this.loadTreeData()
// flowId detail flowId
const flowId = this.detail?.flowId || this.flowId
if (flowId) {
console.log('flowId', flowId)
this.canResendApproval()
}
// this.loadEngineDetailInfo() // this.loadEngineDetailInfo()
}, },
methods: { methods: {
@ -912,7 +964,7 @@ export default {
// //
this.versions = versionArray this.versions = versionArray
.sort((a, b) => b - a) // .sort((a, b) => b - a) //
.map(versionNum => ({ .map((versionNum) => ({
id: versionNum, id: versionNum,
label: `V${versionNum}` label: `V${versionNum}`
})) }))
@ -924,6 +976,14 @@ export default {
if (this.versions.length > 0 && !this.currentVersionId) { if (this.versions.length > 0 && !this.currentVersionId) {
this.currentVersionId = this.versions[0].id this.currentVersionId = this.versions[0].id
} }
this.loadTreeData()
// flowId detail flowId
const flowId = this.detail?.flowId || this.flowId
if (flowId) {
console.log('flowId', flowId)
this.canResendApproval()
}
} }
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
@ -1485,7 +1545,8 @@ export default {
} }
// //
if (this.checkedKeys && this.checkedKeys.length > 0) { if (this.checkedKeys && this.checkedKeys.length > 0) {
this.loadEngineDetail() this.loadTreeData()
} }
}, },
onVersionStatusChange(row, idx, section) { onVersionStatusChange(row, idx, section) {
@ -1626,6 +1687,25 @@ export default {
} }
return false return false
}, },
handleSyncVersion() {
const request = {
...api.GET_NEW_MODEL_VERSION,
params: {
modelId: this.engineModelID,
userId: getUserId()
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
console.log('同步参数版本成功:', resp.data)
}
})
.asyncErrorCatch((err) => {
console.error('同步参数版本失败:', err)
})
},
// //
handleNodeDrop(draggingNode, dropNode, dropType, ev) { handleNodeDrop(draggingNode, dropNode, dropType, ev) {
// //
@ -2175,7 +2255,8 @@ export default {
const request = { const request = {
...api.GET_ENGINE_TABLE_DETAIL, ...api.GET_ENGINE_TABLE_DETAIL,
params: { params: {
modelID: this.detail.id modelID: this.detail.id,
parameterVersion: this.currentVersionId || 1 // 1
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
@ -2202,7 +2283,8 @@ export default {
const request = { const request = {
...api.GET_ENGINE_TABLE_DETAIL, ...api.GET_ENGINE_TABLE_DETAIL,
params: { params: {
modelID: this.detail.id modelID: this.detail.id,
parameterVersion: this.currentVersionId || 1 // 1
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
@ -3325,7 +3407,9 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.fillResendApprovalData(resendData) this.fillResendApprovalData(resendData)
// //
this.originalApprovalWorkflowSteps = JSON.parse(JSON.stringify(this.approvalWorkflowSteps)) this.originalApprovalWorkflowSteps = JSON.parse(
JSON.stringify(this.approvalWorkflowSteps)
)
this.originalProcessTitle = this.approvalFormData.processTitle || '' this.originalProcessTitle = this.approvalFormData.processTitle || ''
// //
this.isResendMode = false this.isResendMode = false
@ -3616,10 +3700,11 @@ export default {
// //
// data.data data // data.data data
const dataSource = (data && data.data) ? data.data : data const dataSource = data && data.data ? data.data : data
if (dataSource && !Array.isArray(dataSource)) { if (dataSource && !Array.isArray(dataSource)) {
if (dataSource.progressTitle || dataSource.processTitle) { if (dataSource.progressTitle || dataSource.processTitle) {
this.approvalFormData.processTitle = dataSource.progressTitle || dataSource.processTitle || '' this.approvalFormData.processTitle =
dataSource.progressTitle || dataSource.processTitle || ''
} else { } else {
// 使 // 使
const productModel = this.detail?.modelName || '产品型号' const productModel = this.detail?.modelName || '产品型号'
@ -3646,7 +3731,7 @@ export default {
} }
// //
const step = this.approvalWorkflowSteps.find(s => s.name === nodeName) const step = this.approvalWorkflowSteps.find((s) => s.name === nodeName)
if (!step) { if (!step) {
console.warn('未找到匹配的审批环节:', nodeName) console.warn('未找到匹配的审批环节:', nodeName)
return return
@ -3661,7 +3746,8 @@ export default {
// assignees // assignees
// assignees idusernameuserNumberaccount // assignees idusernameuserNumberaccount
const handlerInfos = assignees.map(assignee => { const handlerInfos = assignees
.map((assignee) => {
// 使 id userId使 id // 使 id userId使 id
const userId = assignee.id || assignee.userId || '' const userId = assignee.id || assignee.userId || ''
return { return {
@ -3669,20 +3755,27 @@ export default {
username: assignee.username || assignee.userName || '', username: assignee.username || assignee.userName || '',
userNumber: assignee.userNumber || assignee.account || userId userNumber: assignee.userNumber || assignee.account || userId
} }
}).filter(item => item.userId) // userId })
.filter((item) => item.userId) // userId
console.log('处理后的 handlerInfos:', handlerInfos) console.log('处理后的 handlerInfos:', handlerInfos)
// handlers handlers userId // handlers handlers userId
if (handlerInfos.length > 0) { if (handlerInfos.length > 0) {
// 使 Vue.set // 使 Vue.set
this.$set(step, 'handlers', handlerInfos.map(h => h.userId).filter(Boolean)) this.$set(step, 'handlers', handlerInfos.map((h) => h.userId).filter(Boolean))
// options // options
this.$set(step, 'options', handlerInfos.map(h => ({ this.$set(
step,
'options',
handlerInfos
.map((h) => ({
userId: h.userId, userId: h.userId,
username: h.username || '', username: h.username || '',
userNumber: h.userNumber || '' userNumber: h.userNumber || ''
})).filter(opt => opt.userId)) }))
.filter((opt) => opt.userId)
)
console.log('更新后的 step:', step) console.log('更新后的 step:', step)
} }
}) })
@ -3784,8 +3877,10 @@ export default {
for (let i = 0; i < originalNodeList.length; i++) { for (let i = 0; i < originalNodeList.length; i++) {
const original = originalNodeList[i] const original = originalNodeList[i]
const current = currentNodeList[i] const current = currentNodeList[i]
if (original.nodeName !== current.nodeName || if (
JSON.stringify(original.assignees) !== JSON.stringify(current.assignees)) { original.nodeName !== current.nodeName ||
JSON.stringify(original.assignees) !== JSON.stringify(current.assignees)
) {
hasChanged = true hasChanged = true
break break
} }
@ -4749,7 +4844,7 @@ export default {
} }
} }
} }
:deep(.el-tree-node__content){ :deep(.el-tree-node__content) {
padding-left: 10px !important; padding-left: 10px !important;
} }
::v-deep .el-button { ::v-deep .el-button {

View File

@ -3,7 +3,7 @@
<template v-if="!showEngineDetail"> <template v-if="!showEngineDetail">
<div class="page-header"> <div class="page-header">
<div class="title"> <div class="title">
竞品发动机数据 玉柴发动机数据
</div> </div>
<div class="operation"> <div class="operation">
<el-button v-if="hasEngineDataEditPermission()" type="primary" @click="handleDownloadTemplate">下载模板</el-button> <el-button v-if="hasEngineDataEditPermission()" type="primary" @click="handleDownloadTemplate">下载模板</el-button>
@ -108,9 +108,9 @@
> >
查看 查看
</a> </a>
<span v-if="row.distributeStatus != '已分发' && hasEngineDataEditPermission()" class="link-separator"></span> <span v-if=" (row.distributeStatus === '未分发' || row.distributeStatus === '部分分发') &&hasEngineDataEditPermission()" class="link-separator"></span>
<a <a
v-if="row.distributeStatus != '已分发' && hasEngineDataEditPermission()" v-if=" (row.distributeStatus === '未分发' || row.distributeStatus === '部分分发') && hasEngineDataEditPermission()"
href="javascript:void(0)" href="javascript:void(0)"
class="el-link el-link--primary" class="el-link el-link--primary"
style="margin-left: 5px;" style="margin-left: 5px;"
@ -118,7 +118,7 @@
> >
分发 分发
</a> </a>
<span v-if="row.distributeStatus === '未分发' && hasEngineDataEditPermission() && row.versionNumber === 1" class="link-separator"></span> <span class="link-separator" v-if="row.distributeStatus === '未分发' && hasEngineDataEditPermission() && row.versionNumber === 1"></span>
<a <a
v-if="row.distributeStatus === '未分发' && hasEngineDataEditPermission() && row.versionNumber === 1" v-if="row.distributeStatus === '未分发' && hasEngineDataEditPermission() && row.versionNumber === 1"
href="javascript:void(0)" href="javascript:void(0)"
@ -376,7 +376,7 @@ export default {
return false return false
} }
}, },
// //
hasEngineDataEditPermission() { hasEngineDataEditPermission() {
// //
if (this.isAdmin()) { if (this.isAdmin()) {
@ -391,14 +391,14 @@ export default {
if (!Array.isArray(permissionData)) { if (!Array.isArray(permissionData)) {
return false return false
} }
// permissionPath "" parameterPer // permissionPath "" parameterPer
return permissionData.some((perm) => { return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || '' const permissionPath = perm.permissionPath || ''
const parameterPer = perm.parameterPer || '' const parameterPer = perm.parameterPer || ''
return permissionPath === '竞品发动机数据' && parameterPer === '编辑' return permissionPath === '玉柴发动机数据' && parameterPer === '编辑'
}) })
} catch (err) { } catch (err) {
console.error('检查竞品发动机数据编辑权限失败:', err) console.error('检查玉柴发动机数据编辑权限失败:', err)
return false return false
} }
}, },
@ -911,7 +911,4 @@ export default {
width: 4px; width: 4px;
height: 14px; height: 14px;
} }
::v-deep .el-button {
line-height: 0.85 !important;
}
</style> </style>