fix:修改发起审批问题

This commit is contained in:
大黑 2025-12-24 09:03:53 +08:00
parent 280546c410
commit b5f9ca5594
9 changed files with 1231 additions and 846 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

@ -275,6 +275,19 @@
</div>
</div>
<!-- 流程主题 -->
<div class="approval-process-title">
<div class="description-label">
流程主题 <span class="required-mark">*</span>
</div>
<el-input
v-model="approvalFormData.processTitle"
maxlength="100"
show-word-limit
placeholder="请输入流程主题"
/>
</div>
<!-- 说明 -->
<div class="approval-description">
<div class="description-label">
@ -449,6 +462,7 @@ export default {
engineDetailInfo: null, // modelName projectNumber
wholeEngineParamsRawData: [], // ""
approvalFormData: {
processTitle: '',
description: ''
},
approvalSubmitting: false, // loading
@ -2604,6 +2618,7 @@ export default {
this.isApprovalMode = true
//
this.approvalFormData = {
processTitle: '',
description: ''
}
//
@ -2683,6 +2698,7 @@ export default {
this.isApprovalMode = false
//
this.approvalFormData = {
processTitle: '',
description: ''
}
//
@ -2733,6 +2749,13 @@ export default {
return
}
//
const processTitle = (this.approvalFormData.processTitle || '').trim()
if (!processTitle) {
this.$message.warning('请填写流程主题')
return
}
// paramList
const paramList = []
const currentData = this.versionData[this.currentVersionId] || {}
@ -2779,6 +2802,7 @@ export default {
modelId: this.detail.id,
paramList: paramList,
comment: this.approvalFormData.description,
processTitle: processTitle,
nodeList: nodeList,
userId: getUserId()
}

View File

@ -185,6 +185,8 @@
</x-vxe-table>
</div>
<!-- 流程主题 -->
<!-- 说明 -->
<div class="approval-description">
<div class="description-label">
@ -196,6 +198,15 @@
:rows="2"
placeholder="请输入"
/>
<div class="description-label">
流程主题 <span class="required-mark">*</span>
</div>
<el-input
v-model="approvalFormData.processTitle"
maxlength="100"
show-word-limit
placeholder="请输入流程主题"
/>
</div>
<!-- 审批环节 -->
@ -537,6 +548,7 @@ export default {
importFileList: [],
selectedImportFile: null,
approvalFormData: {
processTitle: '',
description: ''
},
approvalSubmitting: false, // loading
@ -591,18 +603,21 @@ export default {
return this.versionList || []
},
shouldShowButtonsNew() {
const status = this.currentStatus || (this.detail && this.detail.status) || ''
// GET_MODEL_DETAIL status
const status = this.currentStatus || ''
return status === 'DRAFT' && this.isLatestVersion
},
//
//
shouldShowButtons() {
// DRAFT COMPLETED
const status = this.currentStatus || (this.detail && this.detail.status) || ''
// GET_MODEL_DETAIL status
// DRAFT COMPLETE
const status = this.currentStatus || ''
return (status === 'DRAFT' || status === 'COMPLETE') && this.isLatestVersion
},
// DRAFT COMPLETED
// DRAFT COMPLETE
shouldShowMaintainButton() {
const status = this.currentStatus || (this.detail && this.detail.status) || ''
// GET_MODEL_DETAIL status
const status = this.currentStatus || ''
const baseCondition = (status === 'DRAFT' || status === 'COMPLETE') && this.isLatestVersion
if (!baseCondition) {
return false
@ -1601,6 +1616,7 @@ export default {
this.isApprovalMode = true
//
this.approvalFormData = {
processTitle: '',
description: ''
}
//
@ -1660,6 +1676,7 @@ export default {
this.originalPaginationForApproval = null
//
this.approvalFormData = {
processTitle: '',
description: ''
}
//
@ -1701,6 +1718,11 @@ export default {
this.$message.error('缺少模板ID无法发起审批')
return
}
const processTitle = (this.approvalFormData.processTitle || '').trim()
if (!processTitle) {
this.$message.warning('请填写流程主题')
return
}
const submitData = {
templateRowId: templateRowId,
@ -1708,6 +1730,7 @@ export default {
reviewUsers: this.approvalWorkflowSteps[1].handlers,
countersignUsers: this.approvalWorkflowSteps[2].handlers,
approveUsers: this.approvalWorkflowSteps[3].handlers,
processTitle: processTitle,
createBy: getUserId(),
userId: getUserId()
}
@ -2334,6 +2357,10 @@ export default {
department: item.department ? this.formatDepartmentDisplay(item.department) : (item.department || '')
}
})
// resp.data result
const statusFromData = resp && resp.data ? (resp.data.status || resp.data.state || '') : ''
const statusFromResult = result && result.length > 0 ? (result[0].status || result[0].state || '') : ''
this.currentStatus = statusFromData || statusFromResult || ''
// 使 Vue.set 使 totalNumber
this.$set(this.pagination, 'total', totalNumber)
})
@ -2446,10 +2473,12 @@ export default {
department: item.department ? this.formatDepartmentDisplay(item.department) : (item.department || '')
}
})
// resp.data result
// GET_MODEL_DETAIL resp.data result
const statusFromData = resp && resp.data ? (resp.data.status || resp.data.state || '') : ''
const statusFromResult = result && result.length > 0 ? (result[0].status || result[0].state || '') : ''
// currentStatus
this.currentStatus = statusFromData || statusFromResult || ''
console.log('从 GET_MODEL_DETAIL 接口获取到的状态:', this.currentStatus)
// 使 Vue.set 使 totalNumber
this.$set(this.pagination, 'total', totalNumber)

View File

@ -190,24 +190,20 @@
<!-- 配置部门模式 -->
<template v-if="personConfigFormData.configType === 'department'">
<el-form-item label="责任部门:" prop="department">
<el-cascader
ref="departmentCascader"
v-model="personConfigFormData.department"
:options="departmentList"
:props="{
multiple: true,
checkStrictly: true,
value: 'id',
label: 'name',
children: 'children',
emitPath: true
}"
filterable
placeholder="请选择责任部门(可多选)"
clearable
<el-input
v-model="selectedDepartmentName"
placeholder="请选择责任部门"
readonly
style="width: 100%"
@change="handlePersonDepartmentChange"
/>
@click.native="handleOpenDepartmentDialog"
>
<i
slot="suffix"
class="el-input__icon el-icon-search"
style="cursor: pointer;"
@click.stop="handleOpenDepartmentDialog"
></i>
</el-input>
</el-form-item>
</template>
<!-- 配置人员模式 -->
@ -263,6 +259,45 @@
</div>
</el-dialog>
<!-- 部门选择弹窗 managerData 一致 -->
<el-dialog
title="选择责任部门"
:visible.sync="departmentDialogVisible"
width="500px"
:close-on-click-modal="false"
append-to-body
@close="handleDepartmentDialogClose"
>
<el-input
v-model="departmentTreeFilterText"
size="small"
placeholder="请输入部门名称进行搜索"
clearable
class="department-tree-search"
>
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<el-tree
ref="departmentTree"
:data="departmentList"
:props="{ children: 'children', label: 'name' }"
node-key="id"
:filter-node-method="filterDepartmentNode"
highlight-current
:expand-on-click-node="false"
class="department-tree"
@node-click="handleDepartmentNodeClick"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="handleDepartmentDialogClose">
取消
</el-button>
<el-button type="primary" :disabled="!selectedDepartmentId" @click="handleDepartmentDialogConfirm">
确定
</el-button>
</div>
</el-dialog>
<!-- 新增/编辑角色对话框 -->
<el-dialog
:title="addRoleMode === 'add' ? '新增角色' : '编辑角色'"
@ -377,6 +412,12 @@ export default {
},
personOptions: [], //
personSearchLoading: false, // loading
// managerData
departmentDialogVisible: false,
departmentTreeFilterText: '',
selectedDepartmentId: '',
selectedDepartmentName: '',
selectedDepartmentNode: null,
personConfigFormRules: {
department: [
{
@ -464,6 +505,48 @@ export default {
console.error('获取用户自身角色失败:', err)
})
},
// managerData
handleOpenDepartmentDialog() {
//
if (this.selectedDepartmentId && this.$refs.departmentTree) {
this.$nextTick(() => {
this.$refs.departmentTree.setCurrentKey(this.selectedDepartmentId)
})
}
this.departmentTreeFilterText = ''
this.departmentDialogVisible = true
},
handleDepartmentDialogClose() {
this.departmentDialogVisible = false
this.departmentTreeFilterText = ''
//
},
handleDepartmentNodeClick(data) {
this.selectedDepartmentId = data.id
this.selectedDepartmentName = this.getDepartmentPathName(data.id) || data.name
this.selectedDepartmentNode = data
},
handleDepartmentDialogConfirm() {
if (!this.selectedDepartmentId) {
this.$message.warning('请选择责任部门')
return
}
this.personConfigFormData.selectDeptIds = [this.selectedDepartmentId]
this.personConfigFormData.department = this.selectedDepartmentId
this.personConfigFormData.selectDeptId = this.selectedDepartmentId
this.personConfigFormData.selectDeptName = this.selectedDepartmentName
this.departmentDialogVisible = false
//
this.$nextTick(() => {
if (this.$refs.personConfigForm) {
this.$refs.personConfigForm.clearValidate('department')
}
})
},
filterDepartmentNode(value, data) {
if (!value) return true
return (data.name || '').toLowerCase().includes(value.toLowerCase())
},
//
validatePermissions(rule, value, callback) {
//
@ -938,37 +1021,30 @@ export default {
// ["deptName-deptId"]
if (deptArray && deptArray.length > 0) {
// managerData
const deptIds = []
const deptPaths = []
let deptNameFromData = ''
deptArray.forEach((deptStr) => {
if (typeof deptStr === 'string' && deptStr.includes('-')) {
// deptName-deptId
const parts = deptStr.split('-')
if (parts.length >= 2) {
// deptId deptName
const deptId = parts[parts.length - 1]
// deptName
// const deptName = parts.slice(0, -1).join('-')
//
const deptPath = this.findDepartmentPath(deptId)
if (deptPath && deptPath.length > 0) {
deptPaths.push(deptPath)
deptNameFromData = parts.slice(0, -1).join('-')
deptIds.push(deptId)
} else {
// 使 deptId
deptIds.push(deptId)
//
deptPaths.push([deptId])
}
}
}
})
if (deptIds.length > 0) {
this.personConfigFormData.selectDeptIds = deptIds
this.personConfigFormData.department = deptPaths
const deptId = deptIds[0]
this.personConfigFormData.selectDeptIds = [deptId]
this.selectedDepartmentId = deptId
//
const pathName = this.getDepartmentPathName(deptId)
this.selectedDepartmentName = pathName || deptNameFromData
this.personConfigFormData.department = deptId
//
if (!personArray || personArray.length === 0) {
this.personConfigFormData.configType = 'department'
@ -976,13 +1052,17 @@ export default {
}
} else {
this.personConfigFormData.selectDeptIds = []
this.personConfigFormData.department = []
this.personConfigFormData.department = ''
this.selectedDepartmentId = ''
this.selectedDepartmentName = ''
}
} else {
this.personOptions = []
this.personConfigFormData.person = []
this.personConfigFormData.selectDeptIds = []
this.personConfigFormData.department = []
this.personConfigFormData.department = ''
this.selectedDepartmentId = ''
this.selectedDepartmentName = ''
}
})
.asyncErrorCatch((err) => {
@ -1068,48 +1148,7 @@ export default {
},
//
handlePersonDepartmentChange(value) {
if (this.personConfigFormData.configType === 'department') {
// value
// [[id1, id2], [id3, id4]]
if (value && Array.isArray(value) && value.length > 0) {
// ID
this.personConfigFormData.selectDeptIds = value.map(path => {
// path ID
if (Array.isArray(path) && path.length > 0) {
return path[path.length - 1]
}
// path ID
return path
}).filter(id => id) //
} else {
this.personConfigFormData.selectDeptIds = []
}
console.log('配置部门模式 - 选中的部门值:', value)
console.log('配置部门模式 - 选中的部门ID数组:', this.personConfigFormData.selectDeptIds)
//
this.$nextTick(() => {
if (this.$refs.personConfigForm) {
this.$refs.personConfigForm.validateField('department')
}
})
} else {
// value
if (value && Array.isArray(value) && value.length > 0) {
// id
this.personConfigFormData.selectDeptId = value[value.length - 1]
//
this.personConfigFormData.selectDeptName = this.getDepartmentPathName(this.personConfigFormData.selectDeptId)
//
this.personConfigFormData.person = []
this.personOptions = []
} else {
//
this.personConfigFormData.selectDeptId = ''
this.personConfigFormData.selectDeptName = ''
this.personConfigFormData.person = []
this.personOptions = []
}
}
// 使使
},
// el-select
queryPersonByDepartment(queryString) {
@ -1285,17 +1324,11 @@ export default {
if (this.personConfigFormData.configType === 'department') {
// ID
isDept = 1
// 使 selectDeptIds department
if (this.personConfigFormData.selectDeptIds && this.personConfigFormData.selectDeptIds.length > 0) {
// 使ID managerData
if (this.selectedDepartmentId) {
userOrDeptId = [this.selectedDepartmentId]
} else if (this.personConfigFormData.selectDeptIds && this.personConfigFormData.selectDeptIds.length > 0) {
userOrDeptId = this.personConfigFormData.selectDeptIds
} else if (this.personConfigFormData.department && Array.isArray(this.personConfigFormData.department) && this.personConfigFormData.department.length > 0) {
// selectDeptIds department
userOrDeptId = this.personConfigFormData.department.map(path => {
if (Array.isArray(path) && path.length > 0) {
return path[path.length - 1]
}
return path
}).filter(id => id)
} else {
userOrDeptId = []
}
@ -1366,6 +1399,9 @@ export default {
roleId: '',
roleName: ''
}
this.selectedDepartmentId = ''
this.selectedDepartmentName = ''
this.selectedDepartmentNode = null
this.personOptions = []
//
if (this.personSearchTimer) {

View File

@ -84,7 +84,9 @@
</div>
<div class="toolbar">
<el-button type="primary" @click="handleCreate">新增</el-button>
<el-button type="primary" @click="handleCreate">
新增
</el-button>
<!-- <el-button @click="handleDownloadTemplate">下载模板</el-button> -->
</div>
<div class="page-data-list">
@ -111,7 +113,9 @@
v-for="(colConfig, index) in tableConfig.colConfigs"
v-slot:[colConfig.customHeadSlot]="{ column }"
>
<div v-if="colConfig.customHeadSlot" :key="index"> {{ column }} {{ colConfig }} </div>
<div v-if="colConfig.customHeadSlot" :key="index">
{{ column }} {{ colConfig }}
</div>
</template>
<template
@ -122,52 +126,60 @@
<span
v-if="row[colConfig.prop] === 'APPROVING'"
style="background: #E6A23C; padding: 4px 8px; color: white; border-radius: 20px;"
>审核中</span
>
审核中
</span>
<span
v-else-if="row[colConfig.prop] === 'COMPLETE'"
style="background: #67C23A; padding: 4px 8px; color: white; border-radius: 20px;"
>已完成</span
>
已完成
</span>
<span
v-else-if="row[colConfig.prop] === 'DRAFT'"
style="background: #909399; padding: 4px 8px; color: white; border-radius: 20px;"
>草稿</span
>
草稿
</span>
<span
v-else-if="row[colConfig.prop] === 'REJECTED'"
style="background: #F56C6C; padding: 4px 8px; color: white; border-radius: 20px;"
>已拒绝</span
>
已拒绝
</span>
<span
v-else
style="background: #909399; padding: 4px 8px; color: white; border-radius: 20px;"
>-</span
>
-
</span>
</div>
<div v-if="colConfig.customSlot === 'options'" :key="'op' + index + '' + rowIndex">
<a
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleRowView(row)"
>查看</a
>
查看
</a>
<span style="width: 6px; display: inline-block"></span>
<a
v-if="false"
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleEdit(row)"
>修改</a
>
修改
</a>
<span style="width: 6px; display: inline-block"></span>
<a
v-if="row.status === 'APPROVING'"
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleApprove(row)"
>审批</a
>
审批
</a>
<span
v-if="row.status === 'APPROVING'"
style="width: 6px; display: inline-block"
@ -177,8 +189,9 @@
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleLaunch(row)"
>发起</a
>
发起
</a>
<span
v-if="!row.status || row.status === '' || row.status === 'DRAFT'"
style="width: 6px; display: inline-block"
@ -188,8 +201,9 @@
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleRestart(row)"
>重新发起</a
>
重新发起
</a>
<span
v-if="row.status === 'REJECTED'"
style="width: 6px; display: inline-block"
@ -199,8 +213,9 @@
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleDownload(row)"
>下载</a
>
下载
</a>
</div>
</template>
@ -344,8 +359,12 @@
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleDialogClose">取消</el-button>
<el-button type="primary" @click="handleSubmit">确定</el-button>
<el-button @click="handleDialogClose">
取消
</el-button>
<el-button type="primary" @click="handleSubmit">
确定
</el-button>
</div>
</el-dialog>
@ -359,6 +378,18 @@
@close="handleLaunchDialogClose"
>
<div class="dialog-body-wrapper">
<div class="approval-process-title">
<div class="description-label">
流程主题 <span class="required-mark">*</span>
</div>
<el-input
v-model="launchProcessTitle"
maxlength="100"
show-word-limit
placeholder="请输入流程主题"
/>
</div>
<div class="approval-workflow">
<div class="workflow-title">
审批环节
@ -414,8 +445,12 @@
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleLaunchDialogClose">取消</el-button>
<el-button type="primary" :loading="launching" @click="handleLaunchSubmit">确定</el-button>
<el-button @click="handleLaunchDialogClose">
取消
</el-button>
<el-button type="primary" :loading="launching" @click="handleLaunchSubmit">
确定
</el-button>
</div>
</el-dialog>
@ -503,6 +538,7 @@ export default {
currentEditRow: null, //
launchDialogVisible: false, //
currentLaunchRow: null, //
launchProcessTitle: '',
launchWorkflowSteps: [
{
name: '校对',
@ -717,6 +753,7 @@ export default {
},
handleLaunch(row) {
this.currentLaunchRow = row
this.launchProcessTitle = row.title || ''
//
this.launchWorkflowSteps = [
{
@ -746,6 +783,7 @@ export default {
handleLaunchDialogClose() {
this.launchDialogVisible = false
this.currentLaunchRow = null
this.launchProcessTitle = ''
//
this.launchWorkflowSteps = [
{
@ -787,6 +825,13 @@ export default {
return
}
//
const processTitle = (this.launchProcessTitle || '').trim()
if (!processTitle) {
this.$message.warning('请填写流程主题')
return
}
const reportId = this.currentLaunchRow.reportId || this.currentLaunchRow.id
if (!reportId) {
this.$message.error('缺少报告ID')
@ -797,6 +842,7 @@ export default {
const submitData = {
reportId: reportId,
userId: getUserId(),
processTitle: processTitle,
proofreadUsers: this.launchWorkflowSteps[0].handlers,
reviewUsers: this.launchWorkflowSteps[1].handlers,
countersignUsers: [],

View File

@ -165,12 +165,12 @@ export default {
},
handleRowView(row) {
//
const processTitle = row.processTitle || ''
const isFillParameterMode = processTitle === '数据维护'
const isResponsibleDispatchMode = processTitle === '任务分解'
const isInApprovalMode = processTitle === '数据审批'
const isModelCheck = processTitle === '模板审核'
const isReportCheck = processTitle === '对标报告审核'
const dataType = row.dataType || ''
const isFillParameterMode = dataType === '数据维护'
const isResponsibleDispatchMode = dataType === '任务分解'
const isInApprovalMode = dataType === '数据审批'
const isModelCheck = dataType === '模板审核'
const isReportCheck = dataType === '对标报告审核'
//
this.currentModel = row.modelName || row.productFullName || ''