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',
method: 'get'
},
GET_NEW_MODEL_VERSION: {
url: '/custom/dataEntryEngineModel/synchronizeParams',
method: 'get'
},
CONTINUE_DATA_APPROVAL: {
url: '/custom/activiti/continueApproval',
method: 'get'

View File

@ -25,12 +25,24 @@
</div>
<div v-if="!isApprovalMode && !hideOperations" class="operation">
<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">
{{ dispatchType === 'update_param' ? '批量修改填写人' : '批量修改责任人' }}
</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 v-else>
<!-- <el-select
@ -41,6 +53,9 @@
>
<el-option v-for="ver in versions" :key="ver.id" :label="ver.label" :value="ver.id" />
</el-select> -->
<el-button size="small" @click="handleSyncVersion">
同步参数版本
</el-button>
<el-button
v-if="!isEditMode && !isJustCheckMode"
size="small"
@ -64,9 +79,22 @@
@change="handleFileChange"
/>
<template v-if="!isEditMode && !isJustCheckMode">
<el-button v-if="hasAnyEditPermission()" size="small" @click="handleEdit">编辑</el-button>
<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 v-if="hasAnyEditPermission()" size="small" @click="handleEdit"
>编辑</el-button
>
<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 type="primary" size="small" @click="handleInitiateApproval">
@ -161,13 +189,28 @@
<div class="section" v-if="shouldShowSection(sectionKey)" :key="sectionKey">
<div class="section-title">{{ formatSectionTitle(sectionKey, sectionData) }}</div>
<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" v-if="!isEditMode || isDispatchMode">填写部门</div>
<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="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">
{{
isDispatchMode && dispatchType === 'update_param'
@ -182,7 +225,11 @@
class="grid-row"
v-for="(row, idx) in sectionData"
: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">
@ -196,7 +243,9 @@
placeholder="请输入"
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>
</div>
<div v-if="!isEditMode || isDispatchMode" class="cell">
@ -220,7 +269,9 @@
</div>
<!-- 填写人列分发模式下且是 update_param 类型时显示已分发的显示名称未分发的可编辑 -->
<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
v-else
v-model="row.filledByUserId"
@ -608,7 +659,13 @@ export default {
//
canSwitchVersion() {
//
return !this.hideOperations && !this.isDispatchMode && !this.fromTodo && !this.filledBy && !this.isEditMode
return (
!this.hideOperations &&
!this.isDispatchMode &&
!this.fromTodo &&
!this.filledBy &&
!this.isEditMode
)
},
// justCheck
isJustCheckMode() {
@ -667,7 +724,8 @@ export default {
contentName: this.progressDetailData.contentName || '',
templateVersion: this.progressDetailData.templateVersion || '',
explanation: this.progressDetailData.explanation || '',
description: this.progressDetailData.explanation || this.progressDetailData.description || ''
description:
this.progressDetailData.explanation || this.progressDetailData.description || ''
}
}
return {
@ -682,15 +740,15 @@ export default {
currentNode() {
if (this.flowNodes && this.flowNodes.length > 0) {
// """"
const approvingNode = this.flowNodes.find((node) =>
node.result === '待审批' || node.result === 'APPROVING'
const approvingNode = this.flowNodes.find(
(node) => node.result === '待审批' || node.result === 'APPROVING'
)
if (approvingNode) {
return approvingNode.node || '--'
}
//
const lastNode = this.flowNodes[this.flowNodes.length - 1]
return lastNode ? (lastNode.node || '--') : '--'
return lastNode ? lastNode.node || '--' : '--'
}
return '--'
},
@ -698,8 +756,8 @@ export default {
currentProcessor() {
if (this.flowNodes && this.flowNodes.length > 0) {
// """"
const approvingNode = this.flowNodes.find((node) =>
node.result === '待审批' || node.result === 'APPROVING'
const approvingNode = this.flowNodes.find(
(node) => node.result === '待审批' || node.result === 'APPROVING'
)
if (approvingNode) {
// 使使
@ -723,11 +781,11 @@ export default {
if (!this.todoId) {
return false
}
//
const currentData = this.versionData[this.currentVersionId] || {}
let hasDistributedData = false
//
Object.keys(currentData).forEach((partsName) => {
const params = currentData[partsName] || []
@ -753,12 +811,12 @@ export default {
}
})
})
//
if (hasDistributedData) {
return false
}
//
if (this.isDispatchMode) {
return true
@ -880,13 +938,7 @@ export default {
//
this.getversions()
//
this.loadTreeData()
// flowId detail flowId
const flowId = this.detail?.flowId || this.flowId
if (flowId) {
console.log('flowId', flowId)
this.canResendApproval()
}
// this.loadEngineDetailInfo()
},
methods: {
@ -912,7 +964,7 @@ export default {
//
this.versions = versionArray
.sort((a, b) => b - a) //
.map(versionNum => ({
.map((versionNum) => ({
id: versionNum,
label: `V${versionNum}`
}))
@ -920,10 +972,18 @@ export default {
// 使
this.versions = versionArray
}
// ID
if (this.versions.length > 0 && !this.currentVersionId) {
// ID
if (this.versions.length > 0 && !this.currentVersionId) {
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) => {
@ -1485,7 +1545,8 @@ export default {
}
//
if (this.checkedKeys && this.checkedKeys.length > 0) {
this.loadEngineDetail()
this.loadTreeData()
}
},
onVersionStatusChange(row, idx, section) {
@ -1626,6 +1687,25 @@ export default {
}
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) {
//
@ -2175,7 +2255,8 @@ export default {
const request = {
...api.GET_ENGINE_TABLE_DETAIL,
params: {
modelID: this.detail.id
modelID: this.detail.id,
parameterVersion: this.currentVersionId || 1 // 1
},
disableSuccessMsg: true
}
@ -2202,7 +2283,8 @@ export default {
const request = {
...api.GET_ENGINE_TABLE_DETAIL,
params: {
modelID: this.detail.id
modelID: this.detail.id,
parameterVersion: this.currentVersionId || 1 // 1
},
disableSuccessMsg: true
}
@ -3325,7 +3407,9 @@ export default {
this.$nextTick(() => {
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.isResendMode = false
@ -3616,10 +3700,11 @@ export default {
//
// 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.progressTitle || dataSource.processTitle) {
this.approvalFormData.processTitle = dataSource.progressTitle || dataSource.processTitle || ''
this.approvalFormData.processTitle =
dataSource.progressTitle || dataSource.processTitle || ''
} else {
// 使
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) {
console.warn('未找到匹配的审批环节:', nodeName)
return
@ -3661,28 +3746,36 @@ export default {
// assignees
// assignees idusernameuserNumberaccount
const handlerInfos = assignees.map(assignee => {
// 使 id userId使 id
const userId = assignee.id || assignee.userId || ''
return {
userId: userId,
username: assignee.username || assignee.userName || '',
userNumber: assignee.userNumber || assignee.account || userId
}
}).filter(item => item.userId) // userId
const handlerInfos = assignees
.map((assignee) => {
// 使 id userId使 id
const userId = assignee.id || assignee.userId || ''
return {
userId: userId,
username: assignee.username || assignee.userName || '',
userNumber: assignee.userNumber || assignee.account || userId
}
})
.filter((item) => item.userId) // userId
console.log('处理后的 handlerInfos:', handlerInfos)
// handlers handlers userId
if (handlerInfos.length > 0) {
// 使 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
this.$set(step, 'options', handlerInfos.map(h => ({
userId: h.userId,
username: h.username || '',
userNumber: h.userNumber || ''
})).filter(opt => opt.userId))
this.$set(
step,
'options',
handlerInfos
.map((h) => ({
userId: h.userId,
username: h.username || '',
userNumber: h.userNumber || ''
}))
.filter((opt) => opt.userId)
)
console.log('更新后的 step:', step)
}
})
@ -3784,8 +3877,10 @@ export default {
for (let i = 0; i < originalNodeList.length; i++) {
const original = originalNodeList[i]
const current = currentNodeList[i]
if (original.nodeName !== current.nodeName ||
JSON.stringify(original.assignees) !== JSON.stringify(current.assignees)) {
if (
original.nodeName !== current.nodeName ||
JSON.stringify(original.assignees) !== JSON.stringify(current.assignees)
) {
hasChanged = true
break
}
@ -4749,7 +4844,7 @@ export default {
}
}
}
:deep(.el-tree-node__content){
:deep(.el-tree-node__content) {
padding-left: 10px !important;
}
::v-deep .el-button {

View File

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