fix:修改

This commit is contained in:
大黑 2026-01-04 14:50:33 +08:00
parent 78937e0ada
commit c37ce897f2
17 changed files with 1513 additions and 969 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

@ -359,7 +359,8 @@ export default {
this.approvalSubmitting = true
const request = {
...api.HANDLE_APPROVAL,
params: submitData
params: submitData,
disableSuccessMsg: true
}
this.$request(request)
@ -367,11 +368,19 @@ export default {
this.approvalSubmitting = false
this.handleApprovalDialogClose()
this.loadData() //
this.$message({
type: 'success',
message: '审批提交成功'
})
})
.asyncErrorCatch((err) => {
this.approvalSubmitting = false
console.error('审批提交失败:', err)
this.handleApprovalDialogClose()
this.$message({
type: 'error',
message: '审批提交失败'
})
})
},
canRecall(row) {
@ -388,17 +397,26 @@ export default {
this.approvalSubmitting = true
const request = {
...api.RETURN_APPROVAL,
params: submitData
params: submitData,
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
this.approvalSubmitting = false
this.loadData() //
this.$message({
type: 'success',
message: '审批提交成功'
})
})
.asyncErrorCatch((err) => {
this.approvalSubmitting = false
console.error('审批提交失败:', err)
this.$message({
type: 'error',
message: '审批提交失败'
})
})
},
currentChange(currentPage) {

View File

@ -616,12 +616,17 @@ export default {
subsystem: this.formData.subsystem,
userId: this.formData.userId, // 使 userNumber
rowId: this.formData.rowId
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
this.submitting = false
this.closeModal()
this.$message({
type: 'success',
message: '修改成功'
})
//
this.$emit('refresh-responsible-persons')
this.$emit('confirm', {
@ -634,7 +639,10 @@ export default {
})
.asyncErrorCatch((err) => {
console.error('修改失败:', err)
this.$message.error('修改失败,请重试')
this.$message({
type: 'error',
message: '修改失败,请重试'
})
this.submitting = false
})
} else {
@ -646,7 +654,8 @@ export default {
department: this.formData.department,
subsystem: this.formData.subsystem,
userId: this.formData.userId
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {

View File

@ -21,7 +21,7 @@
{{ dispatchType === 'update_param' ? '批量修改填写人' : '批量修改责任人' }}
</el-button>
<!-- <el-button size="small" @click="handleSave">保存</el-button> -->
<el-button type="primary" size="small" @click="handleConfirmDispatch">确认分发</el-button>
<el-button type="primary" size="small" :loading="dispatchLoading" @click="handleConfirmDispatch">确认分发</el-button>
</template>
<template v-else>
<el-select
@ -55,13 +55,8 @@
@change="handleFileChange"
/>
<template v-if="!isEditMode && !isJustCheckMode">
<el-button size="small" @click="handleEdit"
>编辑</el-button
>
<el-button
type="primary"
size="small"
@click="handleInitiateApproval"
<el-button size="small" @click="handleEdit">编辑</el-button>
<el-button type="primary" size="small" @click="handleInitiateApproval"
>发起审批</el-button
>
</template>
@ -223,7 +218,7 @@
</div>
<!-- 填写人列只在非分发模式下显示只读 -->
<div v-if="!isDispatchMode && !isEditMode" class="cell">
<span>{{ row.filledBy || '-' }}</span>
<span>{{ row.filledBy || '-' }}</span>
</div>
</div>
</div>
@ -264,8 +259,12 @@
>
<td class="col-engine-model-name">{{ item.engineModelName || '-' }}</td>
<td class="col-subsystem-name">{{ item.subsystemName || '-' }}</td>
<td class="col-parameter-type">{{ (item.partsName === '/' ? item.subsystemName : item.partsName) || '-' }}</td>
<td class="col-parts-name">{{ (item.partsName === '/' ? item.subsystemName : item.partsName) || '-' }}</td>
<td class="col-parameter-type">{{
(item.partsName === '/' ? item.subsystemName : item.partsName) || '-'
}}</td>
<td class="col-parts-name">{{
(item.partsName === '/' ? item.subsystemName : item.partsName) || '-'
}}</td>
<td class="col-parameter-name">{{ item.parameterName || '-' }}</td>
<td class="col-parameter-value">{{ item.parameterValue || '-' }}</td>
<td class="col-common">{{ item.changeComment || '-' }}</td>
@ -276,7 +275,6 @@
</div>
<!-- 流程主题 -->
<!-- 说明 -->
<div class="approval-description">
@ -297,16 +295,14 @@
审批环节
</div>
<div class="approval-process-title">
<div class="description-label">
流程主题 <span class="required-mark">*</span>
<div class="description-label workflow-title-label"> 流程主题 <span class="required-mark">*</span> </div>
<el-input
v-model="approvalFormData.processTitle"
maxlength="100"
show-word-limit
placeholder="请输入流程主题"
/>
</div>
<el-input
v-model="approvalFormData.processTitle"
maxlength="100"
show-word-limit
placeholder="请输入流程主题"
/>
</div>
<div class="workflow-table">
<table class="workflow-table-content">
<thead>
@ -470,6 +466,7 @@ export default {
processTitle: '',
description: ''
},
dispatchLoading: false, // loading
approvalSubmitting: false, // loading
approvalChangeData: [], //
approvalWorkflowSteps: [
@ -525,7 +522,7 @@ export default {
return false
}
// ""
return this.checkedKeys.some(nodeId => {
return this.checkedKeys.some((nodeId) => {
const nodeInfo = this.nodeMap[nodeId]
return nodeInfo && nodeInfo.isWholeEngineParams && nodeInfo.label === '整车参数'
})
@ -561,7 +558,7 @@ export default {
})
//
return {
'整车参数': params
整车参数: params
}
}
},
@ -622,7 +619,8 @@ export default {
...api.GET_ENGINE_VERSIONS,
params: {
modelId: this.currentEngineModelID
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
@ -1124,13 +1122,21 @@ export default {
if (node.children && Array.isArray(node.children)) {
return node.children.some((child) => {
const childNodeInfo = this.nodeMap[child.id]
if (childNodeInfo && childNodeInfo.parentLabel !== null && childNodeInfo.isParent === false) {
if (
childNodeInfo &&
childNodeInfo.parentLabel !== null &&
childNodeInfo.isParent === false
) {
//
const childLabel = (child.label || '').toLowerCase()
if (childLabel.includes(searchValue)) {
return true
}
} else if (childNodeInfo && childNodeInfo.parentLabel !== null && childNodeInfo.isParent === true) {
} else if (
childNodeInfo &&
childNodeInfo.parentLabel !== null &&
childNodeInfo.isParent === true
) {
//
return hasMatchingChild(child)
}
@ -1159,9 +1165,7 @@ export default {
//
// isParent true
return (
nodeInfo.isParent &&
!nodeInfo.isWholeEngineParams &&
nodeInfo.parentLabel !== null //
nodeInfo.isParent && !nodeInfo.isWholeEngineParams && nodeInfo.parentLabel !== null //
)
},
//
@ -1196,7 +1200,11 @@ export default {
//
handleNodeDrop(draggingNode, dropNode, dropType, ev) {
//
const rootNode = this.treeData.find((node) => node.id === draggingNode.data.id || this.nodeMap[draggingNode.data.id]?.parentLabel === node.label)
const rootNode = this.treeData.find(
(node) =>
node.id === draggingNode.data.id ||
this.nodeMap[draggingNode.data.id]?.parentLabel === node.label
)
if (!rootNode) {
// 使
if (this.treeData.length > 0) {
@ -1263,7 +1271,7 @@ export default {
// ""
if (this.isWholeEngineParamsSelected) {
//
const hasNonWholeEngineParamsNode = this.checkedKeys.some(nodeId => {
const hasNonWholeEngineParamsNode = this.checkedKeys.some((nodeId) => {
const nodeInfo = this.nodeMap[nodeId]
return nodeInfo && !nodeInfo.isWholeEngineParams
})
@ -1422,7 +1430,8 @@ export default {
const request = {
...config,
url: requestUrl,
params: this.changeData
params: this.changeData,
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
@ -1436,7 +1445,10 @@ export default {
//
this.loadEngineDetail()
this.$message({
type: 'success',
message: '保存成功'
})
//
this.$nextTick(() => {
this.checkedKeys = savedCheckedKeys
@ -1451,6 +1463,10 @@ export default {
})
.asyncErrorCatch((err) => {
console.error('保存失败:', err)
this.$message({
type: 'error',
message: '保存失败'
})
})
},
handleCancelEdit() {
@ -1475,9 +1491,25 @@ export default {
//
if (this.dispatchType === 'update_param') {
const { subsystem, partsName, department, userId, userNumber, username } = change
console.log(change, 'change', subsystem, partsName, department, userId, userNumber, username)
console.log(
change,
'change',
subsystem,
partsName,
department,
userId,
userNumber,
username
)
// partsName
if (!subsystem || !partsName || !Array.isArray(partsName) || partsName.length === 0 || !department || !userId) {
if (
!subsystem ||
!partsName ||
!Array.isArray(partsName) ||
partsName.length === 0 ||
!department ||
!userId
) {
this.$message({
type: 'warning',
message: '缺少必要参数'
@ -1527,7 +1559,7 @@ export default {
}
//
const existingOption = this.fillerUserOptions[rowId].find(
opt => opt.userId === userId || opt.userNumber === userNumber
(opt) => opt.userId === userId || opt.userNumber === userNumber
)
if (!existingOption) {
//
@ -1574,6 +1606,7 @@ export default {
})
},
handleConfirmDispatch() {
this.dispatchLoading = true
const dispatchData = []
const currentData = this.versionData[this.currentVersionId] || {}
const isUpdateParamMode = this.dispatchType === 'update_param'
@ -1670,16 +1703,21 @@ export default {
type: 'success',
message: '分发成功'
})
this.dispatchLoading = false
//
this.handleBack()
})
.asyncErrorCatch((err) => {
console.error('分发失败:', err)
this.dispatchLoading = false
this.$message({
type: 'error',
message: err.message || '分发失败'
})
})
.finally(() => {
this.dispatchLoading = false
})
},
//
loadEngineDetailInfo() {
@ -1737,7 +1775,9 @@ export default {
const firstLevelKeys = this.getFirstLevelNodeKeys(this.treeData)
const secondLevelKeys = this.getSecondLevelNodeKeys(this.treeData)
// keys
const defaultExpandedKeysForFirstLoad = [...new Set([...firstLevelKeys, ...secondLevelKeys])]
const defaultExpandedKeysForFirstLoad = [
...new Set([...firstLevelKeys, ...secondLevelKeys])
]
// expandedKeys
// /
const isFirstLoad = this.expandedKeys.length === 0
@ -1924,7 +1964,7 @@ export default {
isWholeEngineParams: true //
}
// parentLabel
originalTreeData.forEach(node => {
originalTreeData.forEach((node) => {
const originalParentId = node.id
if (this.nodeMap[originalParentId]) {
this.nodeMap[originalParentId].parentLabel = rootLabel
@ -1938,7 +1978,7 @@ export default {
},
// parentLabel
updateChildrenParentLabel(children, parentLabel) {
children.forEach(child => {
children.forEach((child) => {
if (this.nodeMap[child.id]) {
this.nodeMap[child.id].parentLabel = parentLabel
}
@ -2125,7 +2165,10 @@ export default {
const nodeInfo = this.nodeMap[node.id]
if (nodeInfo) {
//
if (nodeInfo.parentLabel === null || (nodeInfo.parentLabel !== null && nodeInfo.isParent === true)) {
if (
nodeInfo.parentLabel === null ||
(nodeInfo.parentLabel !== null && nodeInfo.isParent === true)
) {
if (allExpandedKeys.includes(node.id) && !node.expanded) {
node.expand()
}
@ -2556,7 +2599,7 @@ export default {
let subsystemMatch = false
if (subsystemName && person.subsystem) {
// subsystem
const personSubsystems = person.subsystem.split(',').map(s => s.trim())
const personSubsystems = person.subsystem.split(',').map((s) => s.trim())
subsystemMatch = personSubsystems.includes(subsystemName)
} else if (!subsystemName && !person.subsystem) {
//
@ -2572,7 +2615,9 @@ export default {
//
// "A-B-C" "A-B-C-D" "A-B-C"
// "A-B"
departmentMatch = normalizedPersonDept === normalizedParamDept || normalizedPersonDept.startsWith(normalizedParamDept + '-')
departmentMatch =
normalizedPersonDept === normalizedParamDept ||
normalizedPersonDept.startsWith(normalizedParamDept + '-')
} else if (!department && !person.department) {
//
departmentMatch = true
@ -2610,11 +2655,7 @@ export default {
if (existingIndex >= 0) {
// 使 Vue.set
this.$set(
this.versionData[this.currentVersionId][groupKey],
existingIndex,
paramData
)
this.$set(this.versionData[this.currentVersionId][groupKey], existingIndex, paramData)
} else {
//
this.versionData[this.currentVersionId][groupKey].push(paramData)
@ -2821,13 +2862,18 @@ export default {
//
const request = {
...api.START_ENGINE_CHECK,
params: submitData
params: submitData,
disableSuccessMsg: true
}
this.approvalSubmitting = true
this.$request(request)
.asyncThen((resp) => {
console.log('审批提交成功')
this.$message({
type: 'success',
message: '审批提交成功'
})
this.approvalSubmitting = false
this.isApprovalMode = false
this.handleBack()
@ -2835,6 +2881,13 @@ export default {
.asyncErrorCatch((err) => {
console.error('审批提交失败:', err)
this.approvalSubmitting = false
this.$message({
type: 'error',
message: '审批提交失败'
})
})
.finally(() => {
this.approvalSubmitting = false
})
},
handleRemoteSearch(query, stepIndex) {
@ -2936,7 +2989,7 @@ export default {
// · -
const normalizedDept = department.replace(/·/g, '-')
// -
const parts = normalizedDept.split('-').filter(part => part.trim() !== '')
const parts = normalizedDept.split('-').filter((part) => part.trim() !== '')
//
if (parts.length > 0) {
return parts[parts.length - 1]
@ -3031,6 +3084,7 @@ export default {
}
.page-approval-content {
background: #fff;
display: flex;
flex: 1;
min-height: 0;
@ -3382,8 +3436,14 @@ export default {
.description-label {
font-size: 14px;
font-weight: 600;
margin-bottom: 8px;
color: #303133;
}
.workflow-title-label {
font-size: 16px;
font-weight: 600;
margin-bottom: 8px;
}
}
.approval-workflow {

View File

@ -608,7 +608,8 @@ export default {
partsName: partsName,
userId: userId,
rowId: this.formData.rowId
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
@ -847,17 +848,24 @@ export default {
...api.DELETE_MANAGER_DATA,
params: {
rowId: row.rowId
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
// this.$message.success('')
this.$message({
type: 'success',
message: '删除成功'
})
//
this.loadFillerData()
})
.asyncErrorCatch((err) => {
console.error('删除失败:', err)
this.$message.error('删除失败')
this.$message({
type: 'error',
message: '删除失败'
})
})
})
.catch(() => {

View File

@ -501,10 +501,25 @@ export default {
department: this.formData.selectDeptName,
subsystem: Array.isArray(this.formData.subsystem) ? this.formData.subsystem.join(',') : this.formData.subsystem,
userId: this.formData.userId || this.formData.responsible
}
},
disableSuccessMsg: true
}
this.$request(request)
this.loadManagerData()
.asyncThen((resp) => {
this.$message({
type: 'success',
message: '新增成功'
})
this.handleDialogClose()
this.loadManagerData()
})
.asyncErrorCatch((err) => {
console.error('新增失败:', err)
this.$message({
type: 'error',
message: '新增失败'
})
})
} else {
//
const request = {
@ -515,18 +530,25 @@ export default {
subsystem: Array.isArray(this.formData.subsystem) ? this.formData.subsystem.join(',') : this.formData.subsystem,
userId: this.formData.responsible,
rowId: this.formData.rowId
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
// this.$message.success('')
this.$message({
type: 'success',
message: '修改成功'
})
this.handleDialogClose()
//
this.loadManagerData()
})
.asyncErrorCatch((err) => {
console.error('修改失败:', err)
this.$message.error('修改失败')
this.$message({
type: 'error',
message: '修改失败'
})
})
}
this.handleDialogClose()
@ -752,7 +774,8 @@ export default {
...api.DELETE_MANAGER_DATA,
params: {
rowId: row.rowId
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
@ -822,6 +845,7 @@ export default {
.header-section {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;

View File

@ -1587,19 +1587,26 @@ export default {
this.savingFavorite = true
const request = {
...api.ADD_USER_COMMONLY_USED,
params: requestData
params: requestData,
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
// this.$message.success('')
this.$message({
type: 'success',
message: '新增常用成功'
})
this.handleAddFavoriteDialogClose()
//
this.loadFavoritesList()
})
.asyncErrorCatch((err) => {
console.error('新增常用失败:', err)
this.$message.error(err.message || '新增常用失败')
this.$message({
type: 'error',
message: '新增常用失败'
})
})
.finally(() => {
this.savingFavorite = false

View File

@ -575,22 +575,6 @@ export default {
this.currentDetail = {}
this.loadData()
},
demoGetPerson() {
const request = {
...api.GET_ALLUSERS,
disableSuccessMsg: true,
params: {
name: '李'
}
}
this.$request(request)
.asyncThen((resp) => {
console.log(resp, 'resp')
})
.asyncErrorCatch((err) => {
console.error('获取人员失败:', err)
})
},
handleRowVersion(row) {
this.$refs.versionModal.showModal(row)
},
@ -859,7 +843,8 @@ export default {
params: {
pageNumber: 1,
pageSize: 10
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
@ -944,7 +929,8 @@ export default {
//
const request = {
...api.ADD_MODEL,
params: formData
params: formData,
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {

View File

@ -1941,14 +1941,18 @@ export default {
//
const request = {
...api.START_APPROVAL,
params: submitData
params: submitData,
disableSuccessMsg: true
}
this.approvalSubmitting = true
this.$request(request)
.asyncThen((resp) => {
console.log('审批提交成功')
// this.$message.success('')
this.$message({
type: 'success',
message: '审批提交成功'
})
this.isApprovalMode = false
this.approvalSubmitting = false
//
@ -1958,7 +1962,10 @@ export default {
})
.asyncErrorCatch((err) => {
console.error('审批提交失败:', err)
this.$message.error('审批提交失败,请重试')
this.$message({
type: 'error',
message: '审批提交失败,请重试'
})
})
.finally(() => {
this.approvalSubmitting = false

View File

@ -562,7 +562,8 @@ export default {
//
const request = {
...api.HANDLE_ENGINE_CHECK,
params: submitData
params: submitData,
disableSuccessMsg: true
}
this.approvalSubmitting = true
@ -600,7 +601,8 @@ export default {
...api.RETURN_ENGINE_CHECK,
params: {
approvalId: row.id
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {

View File

@ -1304,11 +1304,16 @@ export default {
roleName: this.addRoleFormData.roleName,
roleCode: this.addRoleFormData.roleCode,
roleDescription: this.addRoleFormData.roleDescription
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
this.handleAddRoleDialogClose()
this.$message({
type: 'success',
message: isEdit ? '编辑角色成功' : '新增角色成功'
})
this.loadPermissionData()
})
.asyncErrorCatch((err) => {

View File

@ -84,7 +84,7 @@
</div>
<div class="toolbar">
<el-button type="primary" @click="handleCreate">
<el-button v-if="hasReportEditPermission()" type="primary" @click="handleCreate">
新增
</el-button>
<!-- <el-button @click="handleDownloadTemplate">下载模板</el-button> -->
@ -164,7 +164,7 @@
</a>
<span style="width: 6px; display: inline-block"></span>
<a
v-if="row.status === 'DRAFT'"
v-if="row.status === 'DRAFT' && hasReportEditPermission()"
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleEdit(row)"
@ -197,7 +197,7 @@
style="width: 6px; display: inline-block"
></span>
<a
v-if="row.status === 'REJECTED'"
v-if="row.status === 'REJECTED' && hasReportEditPermission()"
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleEdit(row)"
@ -675,9 +675,84 @@ export default {
}
},
created() {
this.loadUserSelfRole()
this.loadData()
},
methods: {
// isAdmin === 1
isAdmin() {
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// isAdmin === 1
return permissionData.some((perm) => perm.isAdmin === 1 || perm.isAdmin === '1')
} catch (err) {
console.error('检查管理员权限失败:', err)
return false
}
},
//
hasReportEditPermission() {
//
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// permissionPath "" parameterPer
// parameterPer 2 "" "2"
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
const parameterPer = perm.parameterPer
return (
permissionPath === '报告' &&
(parameterPer === 2 ||
parameterPer === '2' ||
parameterPer === '编辑')
)
})
} catch (err) {
console.error('检查报告编辑权限失败:', err)
return false
}
},
//
loadUserSelfRole() {
const request = {
...api.GET_USER_SELF_ROLE,
params: {
userOrDepID: getUserId()
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
}
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
})
},
handleCreate() {
this.dialogMode = 'create'
this.currentRestartRow = null
@ -817,9 +892,9 @@ export default {
if (requiredStepsWithoutHandlers.length > 0) {
const stepNames = requiredStepsWithoutHandlers.map((step) => step.name).join('、')
this.$message({
type: 'warning',
message: `请为必填环节"${stepNames}"选择处理人`
})
type: 'warning',
message: `请为必填环节"${stepNames}"选择处理人`
})
return
}
@ -1053,8 +1128,8 @@ export default {
}
const file = this.selectedFile
console.log(file,2222);
console.log(file, 2222)
const formData = new FormData()
formData.append('file', file)
formData.append('createBy', getUserId())

View File

@ -1300,7 +1300,8 @@ export default {
...this.editFormData,
createBy: getUserId(),
userId: getUserId()
}
},
disableSuccessMsg: true
}
this.saving = true

View File

@ -562,7 +562,8 @@ export default {
//
const request = {
...api.HANDLE_ENGINE_CHECK,
params: submitData
params: submitData,
disableSuccessMsg: true
}
this.approvalSubmitting = true
@ -600,7 +601,8 @@ export default {
...api.RETURN_ENGINE_CHECK,
params: {
approvalId: row.id
}
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {