feat:同步参数
This commit is contained in:
parent
d002e3ff8c
commit
8636778f9d
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
@ -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'
|
||||
|
||||
@ -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) {
|
||||
// 优先使用待处理人,如果没有则使用已处理人
|
||||
@ -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}`
|
||||
}))
|
||||
@ -924,6 +976,14 @@ export default {
|
||||
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,7 +3746,8 @@ export default {
|
||||
|
||||
// 从 assignees 中提取人员信息
|
||||
// 根据返回的数据结构,assignees 中的对象有 id、username、userNumber、account 等字段
|
||||
const handlerInfos = assignees.map(assignee => {
|
||||
const handlerInfos = assignees
|
||||
.map((assignee) => {
|
||||
// 使用 id 作为 userId(因为返回数据中使用的是 id 字段)
|
||||
const userId = assignee.id || assignee.userId || ''
|
||||
return {
|
||||
@ -3669,20 +3755,27 @@ export default {
|
||||
username: assignee.username || assignee.userName || '',
|
||||
userNumber: assignee.userNumber || assignee.account || userId
|
||||
}
|
||||
}).filter(item => item.userId) // 过滤掉没有 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 => ({
|
||||
this.$set(
|
||||
step,
|
||||
'options',
|
||||
handlerInfos
|
||||
.map((h) => ({
|
||||
userId: h.userId,
|
||||
username: h.username || '',
|
||||
userNumber: h.userNumber || ''
|
||||
})).filter(opt => opt.userId))
|
||||
}))
|
||||
.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
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user