fix
This commit is contained in:
parent
a399336d3d
commit
4e1bef2888
@ -54,6 +54,15 @@ export default {
|
||||
url: '/custom/engineParamDetailPojo/selectParamListAndModelForFilledBy',
|
||||
method: 'get'
|
||||
},
|
||||
GET_ENGINE_TABLE_DETAIL_FOR_FILLED_BY_HISTORY: {
|
||||
url: '/custom/engineParamDetailPojo/selectParamListAndModelForFilledByHistory',
|
||||
method: 'get'
|
||||
},
|
||||
// 责任人分发填写人时获取参数树(传参与 GET_ENGINE_TABLE_DETAIL 相同,userID 为责任人 ID)
|
||||
GET_ENGINE_TABLE_DETAIL_FOR_RESPONSIBLE_PERSON: {
|
||||
url: '/custom/engineParamDetailPojo/selectParamListAndModelForResponsiblePerson',
|
||||
method: 'get'
|
||||
},
|
||||
GET_NEW_MODEL_VERSION: {
|
||||
url: '/custom/dataEntryEngineModel/synchronizeParams',
|
||||
method: 'get'
|
||||
|
||||
@ -16,8 +16,10 @@
|
||||
<el-form-item label="子系统:" prop="subsystem">
|
||||
<el-select
|
||||
v-model="formData.subsystem"
|
||||
placeholder="请选择子系统"
|
||||
:placeholder="dispatchType === 'update_param' ? '请选择子系统(可多选)' : '请选择子系统'"
|
||||
clearable
|
||||
:multiple="dispatchType === 'update_param'"
|
||||
collapse-tags
|
||||
style="width: 100%"
|
||||
@change="handleSubsystemChange"
|
||||
>
|
||||
@ -31,7 +33,7 @@
|
||||
clearable
|
||||
multiple
|
||||
style="width: 100%"
|
||||
:disabled="!formData.subsystem"
|
||||
:disabled="!hasSelectedSubsystem"
|
||||
@change="handlePartsNameChange"
|
||||
>
|
||||
<el-option
|
||||
@ -42,20 +44,13 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门:" prop="department">
|
||||
<el-form-item v-if="dispatchType !== 'update_param'" label="部门:" prop="department">
|
||||
<el-select
|
||||
v-model="formData.department"
|
||||
placeholder="请选择部门"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="
|
||||
dispatchType === 'update_param'
|
||||
? !formData.subsystem ||
|
||||
!formData.partsName ||
|
||||
!Array.isArray(formData.partsName) ||
|
||||
formData.partsName.length === 0
|
||||
: !formData.subsystem
|
||||
"
|
||||
:disabled="!formData.subsystem"
|
||||
@change="handleDepartmentChange"
|
||||
>
|
||||
<el-option
|
||||
@ -88,7 +83,7 @@
|
||||
"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
:disabled="!formData.department"
|
||||
:disabled="dispatchType !== 'update_param' && !formData.department"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="handleRemoteSearch"
|
||||
@ -125,6 +120,9 @@
|
||||
|
||||
<script>
|
||||
import api from '@/api'
|
||||
|
||||
const WHOLE_ENGINE_PARAMS_LEGACY_KEYS = ['整车参数', '发动机基本信息']
|
||||
|
||||
export default {
|
||||
name: 'BatchModifyResponsibleModal',
|
||||
props: {
|
||||
@ -151,6 +149,21 @@ export default {
|
||||
currentVersionId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 由父组件 engineDetail 传入,解析部门 departmentId(含中轻/中重动力平台映射)
|
||||
resolveDepartmentId: {
|
||||
type: Function,
|
||||
default: null
|
||||
},
|
||||
// 左侧参数树第一级(项目名称),用于匹配责任人/填写人
|
||||
projectPartsName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 左侧参数树展示的子系统名称列表
|
||||
treeSubsystemNames: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -174,6 +187,7 @@ export default {
|
||||
availablePartsNames: [], // 根据子系统筛选出的零部件名称列表(仅用于批量修改填写人)
|
||||
availableDepartments: [], // 根据子系统筛选出的部门列表
|
||||
allManagerData: [], // 所有责任人数据(用于查找现责任人和部门)
|
||||
allFillerData: [], // 所有填写人数据(用于查找现填写人)
|
||||
departmentTreeData: [], // 部门树数据(用于根据部门名称查找部门ID)
|
||||
userOptions: [], // 人员选项列表
|
||||
userLoading: false // 人员搜索loading状态
|
||||
@ -183,9 +197,16 @@ export default {
|
||||
modalTitle() {
|
||||
return this.dispatchType === 'update_param' ? '批量修改填写人' : '批量修改责任人'
|
||||
},
|
||||
hasSelectedSubsystem() {
|
||||
if (this.dispatchType === 'update_param') {
|
||||
return (
|
||||
Array.isArray(this.formData.subsystem) && this.formData.subsystem.length > 0
|
||||
)
|
||||
}
|
||||
return !!this.formData.subsystem
|
||||
},
|
||||
formRules() {
|
||||
const rules = {
|
||||
subsystem: [{ required: true, message: '请选择子系统', trigger: 'change' }],
|
||||
userId: [
|
||||
{
|
||||
required: true,
|
||||
@ -194,10 +215,16 @@ export default {
|
||||
}
|
||||
]
|
||||
}
|
||||
// 添加部门验证(两种模式都需要)
|
||||
rules.department = [{ required: true, message: '请选择部门', trigger: 'change' }]
|
||||
// 如果是批量修改填写人,添加零部件名称验证
|
||||
if (this.dispatchType === 'update_param') {
|
||||
rules.subsystem = [
|
||||
{
|
||||
required: true,
|
||||
type: 'array',
|
||||
min: 1,
|
||||
message: '请至少选择一个子系统',
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
rules.partsName = [
|
||||
{
|
||||
required: true,
|
||||
@ -207,6 +234,9 @@ export default {
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
} else {
|
||||
rules.subsystem = [{ required: true, message: '请选择子系统', trigger: 'change' }]
|
||||
rules.department = [{ required: true, message: '请选择部门', trigger: 'change' }]
|
||||
}
|
||||
return rules
|
||||
}
|
||||
@ -228,10 +258,26 @@ export default {
|
||||
// 否则显示全部
|
||||
return normalizedDept
|
||||
},
|
||||
getEmptySubsystemValue() {
|
||||
return this.dispatchType === 'update_param' ? [] : ''
|
||||
},
|
||||
getSelectedSubsystems() {
|
||||
if (this.dispatchType === 'update_param') {
|
||||
return Array.isArray(this.formData.subsystem) ? this.formData.subsystem : []
|
||||
}
|
||||
return this.formData.subsystem ? [this.formData.subsystem] : []
|
||||
},
|
||||
isParamSubsystemMatched(paramSubsystemName, selectedSubsystems) {
|
||||
const subsystems = selectedSubsystems || this.getSelectedSubsystems()
|
||||
if (!subsystems.length) {
|
||||
return false
|
||||
}
|
||||
return subsystems.some((name) => this.isSubsystemNameMatch(paramSubsystemName, name))
|
||||
},
|
||||
showModal() {
|
||||
// 重置表单数据
|
||||
this.formData = {
|
||||
subsystem: '',
|
||||
subsystem: this.getEmptySubsystemValue(),
|
||||
partsName: [],
|
||||
department: '',
|
||||
currentResponsibleId: '',
|
||||
@ -264,7 +310,7 @@ export default {
|
||||
closeModal() {
|
||||
this.visible = false
|
||||
this.formData = {
|
||||
subsystem: '',
|
||||
subsystem: this.getEmptySubsystemValue(),
|
||||
partsName: [],
|
||||
department: '',
|
||||
currentResponsibleId: '',
|
||||
@ -289,25 +335,65 @@ export default {
|
||||
}
|
||||
this.$request(request)
|
||||
.asyncThen((resp) => {
|
||||
if (resp && resp.data) {
|
||||
this.subsystemList = resp.data
|
||||
} else {
|
||||
this.subsystemList = []
|
||||
}
|
||||
const apiList = resp && resp.data ? resp.data : []
|
||||
this.filterSubsystemListByTree(apiList)
|
||||
})
|
||||
.asyncErrorCatch((err) => {
|
||||
console.error('加载子系统列表失败:', err)
|
||||
this.subsystemList = []
|
||||
})
|
||||
},
|
||||
// 子系统名称是否匹配(兼容整车参数/发动机基本信息)
|
||||
isSubsystemNameMatch(nameA, nameB) {
|
||||
if (!nameA || !nameB) {
|
||||
return false
|
||||
}
|
||||
if (nameA === nameB) {
|
||||
return true
|
||||
}
|
||||
return (
|
||||
WHOLE_ENGINE_PARAMS_LEGACY_KEYS.includes(nameA) &&
|
||||
WHOLE_ENGINE_PARAMS_LEGACY_KEYS.includes(nameB)
|
||||
)
|
||||
},
|
||||
// 根据左侧树展示的子系统,从接口返回的列表中删减
|
||||
filterSubsystemListByTree(apiList) {
|
||||
const list = Array.isArray(apiList) ? apiList : []
|
||||
const treeNames = (this.treeSubsystemNames || []).filter(Boolean)
|
||||
if (!treeNames.length) {
|
||||
this.subsystemList = list
|
||||
return
|
||||
}
|
||||
const filtered = []
|
||||
list.forEach((apiName) => {
|
||||
const matchedTreeName = treeNames.find((treeName) =>
|
||||
this.isSubsystemNameMatch(apiName, treeName)
|
||||
)
|
||||
if (matchedTreeName && !filtered.includes(matchedTreeName)) {
|
||||
filtered.push(matchedTreeName)
|
||||
}
|
||||
})
|
||||
this.subsystemList = filtered
|
||||
},
|
||||
// 是否匹配当前项目名称(partsName)
|
||||
isProjectPartsNameMatch(item) {
|
||||
if (!this.projectPartsName || !item) {
|
||||
return true
|
||||
}
|
||||
return (item.partsName || '') === this.projectPartsName
|
||||
},
|
||||
// 加载所有责任人数据(用于查找现责任人和部门)
|
||||
loadAllManagerData() {
|
||||
const request = {
|
||||
...api.GET_MANAGER_DATA,
|
||||
params: {
|
||||
const params = {
|
||||
pageNumber: 1,
|
||||
pageSize: 9999 // 获取所有数据
|
||||
},
|
||||
}
|
||||
if (this.projectPartsName) {
|
||||
params.partsName = this.projectPartsName
|
||||
}
|
||||
const request = {
|
||||
...api.GET_MANAGER_DATA,
|
||||
params,
|
||||
disableSuccessMsg: true
|
||||
}
|
||||
this.$request(request)
|
||||
@ -323,8 +409,35 @@ export default {
|
||||
this.allManagerData = []
|
||||
})
|
||||
},
|
||||
// 加载所有填写人数据(用于查找现填写人)
|
||||
loadAllFillerData() {
|
||||
const params = {
|
||||
pageNumber: 1,
|
||||
pageSize: 9999
|
||||
}
|
||||
if (this.projectPartsName) {
|
||||
params.partsName = this.projectPartsName
|
||||
}
|
||||
const request = {
|
||||
...api.GET_FILLER_DATA,
|
||||
params,
|
||||
disableSuccessMsg: true
|
||||
}
|
||||
this.$request(request)
|
||||
.asyncThen((resp) => {
|
||||
if (resp && resp.data) {
|
||||
this.allFillerData = resp.data.result || []
|
||||
} else {
|
||||
this.allFillerData = []
|
||||
}
|
||||
})
|
||||
.asyncErrorCatch((err) => {
|
||||
console.error('加载填写人数据失败:', err)
|
||||
this.allFillerData = []
|
||||
})
|
||||
},
|
||||
// 处理子系统选择变化
|
||||
handleSubsystemChange(subsystem) {
|
||||
handleSubsystemChange() {
|
||||
// 清空零部件名称、部门和现责任人/现填写人
|
||||
this.formData.partsName = []
|
||||
this.formData.department = ''
|
||||
@ -339,113 +452,54 @@ export default {
|
||||
this.availablePartsNames = []
|
||||
this.availableDepartments = []
|
||||
this.userOptions = []
|
||||
// 根据子系统筛选零部件名称和部门列表
|
||||
if (subsystem) {
|
||||
|
||||
const selectedSubsystems = this.getSelectedSubsystems()
|
||||
if (!selectedSubsystems.length) {
|
||||
this.availablePartsNames = []
|
||||
this.availableDepartments = []
|
||||
return
|
||||
}
|
||||
|
||||
const currentVersionData = this.versionData[this.currentVersionId] || {}
|
||||
const partsNameSet = new Set()
|
||||
const departmentSet = new Set()
|
||||
|
||||
// 遍历所有零部件名称(partsName)
|
||||
Object.keys(currentVersionData).forEach((partsName) => {
|
||||
const params = currentVersionData[partsName] || []
|
||||
// 遍历该零部件下的所有参数
|
||||
params.forEach((param) => {
|
||||
// 检查参数是否属于选中的子系统
|
||||
if (param.subsystemName === subsystem) {
|
||||
// 如果是批量修改填写人,收集零部件名称(包括 /)
|
||||
if (!this.isParamSubsystemMatched(param.subsystemName, selectedSubsystems)) {
|
||||
return
|
||||
}
|
||||
if (this.dispatchType === 'update_param') {
|
||||
const paramPartsName = param.partsName || partsName
|
||||
if (paramPartsName) {
|
||||
partsNameSet.add(paramPartsName)
|
||||
}
|
||||
}
|
||||
// 收集部门名称(两种模式都需要)
|
||||
if (param.department) {
|
||||
departmentSet.add(param.department)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 如果是批量修改填写人,设置零部件名称列表(添加 / 作为默认项)
|
||||
if (this.dispatchType === 'update_param') {
|
||||
const partsNamesArray = Array.from(partsNameSet).sort()
|
||||
// 如果 / 不在列表中,添加到开头
|
||||
if (!partsNamesArray.includes('/')) {
|
||||
partsNamesArray.unshift('/')
|
||||
}
|
||||
this.availablePartsNames = partsNamesArray
|
||||
// 对于批量修改填写人,部门列表应该在选择了零部件名称之后才筛选
|
||||
this.availableDepartments = []
|
||||
} else {
|
||||
// 批量修改责任人:设置部门列表(转换为数组格式)
|
||||
this.availableDepartments = Array.from(departmentSet).map((dept) => ({
|
||||
department: dept
|
||||
}))
|
||||
}
|
||||
} else {
|
||||
this.availablePartsNames = []
|
||||
this.availableDepartments = []
|
||||
}
|
||||
},
|
||||
// 处理零部件名称选择变化(仅用于批量修改填写人)
|
||||
handlePartsNameChange(partsNames) {
|
||||
// partsNames 现在是数组
|
||||
// 清空部门、现填写人和新填写人
|
||||
this.formData.department = ''
|
||||
this.formData.currentFillerId = ''
|
||||
this.formData.currentFillerName = ''
|
||||
handlePartsNameChange() {
|
||||
this.formData.userId = ''
|
||||
this.formData.userNumber = ''
|
||||
this.formData.username = ''
|
||||
this.availableDepartments = []
|
||||
this.userOptions = []
|
||||
// 根据子系统和零部件名称筛选部门列表
|
||||
if (
|
||||
partsNames &&
|
||||
Array.isArray(partsNames) &&
|
||||
partsNames.length > 0 &&
|
||||
this.formData.subsystem
|
||||
) {
|
||||
this.filterDepartmentsByPartsName()
|
||||
}
|
||||
},
|
||||
// 根据子系统和零部件名称筛选部门列表(仅用于批量修改填写人)
|
||||
filterDepartmentsByPartsName() {
|
||||
if (
|
||||
!this.formData.subsystem ||
|
||||
!this.formData.partsName ||
|
||||
!Array.isArray(this.formData.partsName) ||
|
||||
this.formData.partsName.length === 0
|
||||
) {
|
||||
this.availableDepartments = []
|
||||
return
|
||||
}
|
||||
|
||||
const currentVersionData = this.versionData[this.currentVersionId] || {}
|
||||
const departmentSet = new Set()
|
||||
|
||||
// 遍历所有零部件名称(partsName)
|
||||
Object.keys(currentVersionData).forEach((dataPartsName) => {
|
||||
const params = currentVersionData[dataPartsName] || []
|
||||
// 遍历该零部件下的所有参数
|
||||
params.forEach((param) => {
|
||||
// 检查参数是否属于选中的子系统和任意一个选中的零部件名称
|
||||
const paramPartsName = param.partsName || dataPartsName
|
||||
if (
|
||||
param.subsystemName === this.formData.subsystem &&
|
||||
this.formData.partsName.includes(paramPartsName) &&
|
||||
param.department
|
||||
) {
|
||||
departmentSet.add(param.department)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 转换为数组格式
|
||||
this.availableDepartments = Array.from(departmentSet).map((dept) => ({
|
||||
department: dept
|
||||
}))
|
||||
},
|
||||
// 处理部门选择变化
|
||||
handleDepartmentChange(department) {
|
||||
@ -457,7 +511,6 @@ export default {
|
||||
this.formData.userNumber = ''
|
||||
this.formData.username = ''
|
||||
this.userOptions = []
|
||||
// 如果是批量修改填写人,不需要查找现填写人
|
||||
if (this.dispatchType === 'update_param') {
|
||||
return
|
||||
}
|
||||
@ -466,7 +519,13 @@ export default {
|
||||
const matchedItem = this.allManagerData.find((item) => {
|
||||
// 检查子系统是否匹配
|
||||
const itemSubsystems = item.subsystem ? item.subsystem.split(',') : []
|
||||
return itemSubsystems.includes(this.formData.subsystem) && item.department === department
|
||||
return (
|
||||
itemSubsystems.some((name) =>
|
||||
this.isSubsystemNameMatch(name.trim(), this.formData.subsystem)
|
||||
) &&
|
||||
item.department === department &&
|
||||
this.isProjectPartsNameMatch(item)
|
||||
)
|
||||
})
|
||||
if (matchedItem) {
|
||||
// 找到现责任人
|
||||
@ -483,8 +542,7 @@ export default {
|
||||
},
|
||||
// 远程搜索责任人/填写人
|
||||
handleRemoteSearch(query) {
|
||||
// 两种模式都需要检查部门
|
||||
if (!this.formData.department) {
|
||||
if (this.dispatchType !== 'update_param' && !this.formData.department) {
|
||||
this.userOptions = []
|
||||
return
|
||||
}
|
||||
@ -584,15 +642,6 @@ export default {
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
// 验证必填字段
|
||||
if (!this.formData.subsystem) {
|
||||
this.$message.warning('请选择子系统')
|
||||
return
|
||||
}
|
||||
if (!this.formData.department) {
|
||||
this.$message.warning('请选择部门')
|
||||
return
|
||||
}
|
||||
if (!this.formData.userId) {
|
||||
const fieldName = this.dispatchType === 'update_param' ? '人员' : '责任人'
|
||||
this.$message.warning(`请选择${fieldName}`)
|
||||
@ -601,7 +650,11 @@ export default {
|
||||
|
||||
// 如果是批量修改填写人,不调用接口,直接触发确认事件
|
||||
if (this.dispatchType === 'update_param') {
|
||||
// 验证零部件名称
|
||||
const selectedSubsystems = this.getSelectedSubsystems()
|
||||
if (!selectedSubsystems.length) {
|
||||
this.$message.warning('请至少选择一个子系统')
|
||||
return
|
||||
}
|
||||
if (
|
||||
!this.formData.partsName ||
|
||||
!Array.isArray(this.formData.partsName) ||
|
||||
@ -610,14 +663,11 @@ export default {
|
||||
this.$message.warning('请至少选择一个零部件名称')
|
||||
return
|
||||
}
|
||||
// 确保所有必要参数都有值
|
||||
// 如果 userNumber 为空,使用 userId 作为 userNumber(降级处理)
|
||||
const confirmData = {
|
||||
subsystem: this.formData.subsystem,
|
||||
partsName: this.formData.partsName, // 现在是数组
|
||||
department: this.formData.department,
|
||||
userId: this.formData.userId, // 确保传递userId
|
||||
userNumber: this.formData.userNumber || this.formData.userId, // 如果没有 userNumber,使用 userId
|
||||
subsystem: selectedSubsystems,
|
||||
partsName: this.formData.partsName,
|
||||
userId: this.formData.userId,
|
||||
userNumber: this.formData.userNumber || this.formData.userId,
|
||||
username: this.formData.username || ''
|
||||
}
|
||||
console.log('批量修改填写人 - 提交数据:', confirmData)
|
||||
@ -658,6 +708,7 @@ export default {
|
||||
departmentId: this.getDepartmentIdByDepartment(this.formData.department),
|
||||
department: this.formData.department,
|
||||
subsystem: this.formData.subsystem,
|
||||
partsName: this.projectPartsName || '',
|
||||
userId: this.formData.userId, // 使用 userNumber
|
||||
rowId: this.formData.rowId
|
||||
},
|
||||
@ -697,6 +748,7 @@ export default {
|
||||
departmentId: this.getDepartmentIdByDepartment(this.formData.department),
|
||||
department: this.formData.department,
|
||||
subsystem: this.formData.subsystem,
|
||||
partsName: this.projectPartsName || '',
|
||||
userId: this.formData.userId
|
||||
},
|
||||
disableSuccessMsg: true
|
||||
@ -764,6 +816,12 @@ export default {
|
||||
},
|
||||
// 根据部门名称获取部门ID(从部门树中查找)
|
||||
getDepartmentIdByDepartment(department) {
|
||||
if (typeof this.resolveDepartmentId === 'function') {
|
||||
const resolvedId = this.resolveDepartmentId(department)
|
||||
if (resolvedId) {
|
||||
return resolvedId
|
||||
}
|
||||
}
|
||||
if (!department || !this.departmentTreeData || this.departmentTreeData.length === 0) {
|
||||
// 如果部门树没有加载,尝试从 allManagerData 中查找
|
||||
if (this.allManagerData && this.allManagerData.length > 0) {
|
||||
|
||||
@ -463,7 +463,7 @@ export default {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
font-size: 12px;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="subsystem" label="子系统" align="center" />
|
||||
<el-table-column prop="partsName" label="状态代号" align="center" />
|
||||
<el-table-column prop="username" label="责任人" width="250" align="center" />
|
||||
<el-table-column v-if="hasEditPermission()" label="操作" width="200" align="center">
|
||||
<template slot-scope="scope">
|
||||
@ -115,6 +116,15 @@
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目名称:" prop="partsName">
|
||||
<el-input
|
||||
v-model="formData.partsName"
|
||||
placeholder="请输入项目名称"
|
||||
clearable
|
||||
maxlength="100"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="责任部门:" prop="department">
|
||||
<el-input
|
||||
v-model="formData.selectDeptName"
|
||||
@ -267,6 +277,7 @@ export default {
|
||||
formData: {
|
||||
department: '', // 级联选择器绑定的部门ID
|
||||
subsystem: '', // 子系统
|
||||
partsName: '', // 项目名称
|
||||
responsible: '', // 责任人用户ID(用于提交)
|
||||
responsibleName: '', // 责任人姓名(用于自动完成显示)
|
||||
selectDeptId: '', // 选中的部门ID(用于搜索责任人)
|
||||
@ -278,6 +289,7 @@ export default {
|
||||
formRules: {
|
||||
department: [{ required: true, message: '请选择责任部门', trigger: 'change' }],
|
||||
subsystem: [{ required: true, message: '请输入子系统', trigger: 'blur' }],
|
||||
partsName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
|
||||
responsible: [{ required: true, message: '请选择责任人', trigger: 'change' }]
|
||||
},
|
||||
subsystemList: [],
|
||||
@ -570,6 +582,7 @@ export default {
|
||||
this.formData = {
|
||||
department: '',
|
||||
subsystem: '',
|
||||
partsName: '',
|
||||
responsible: '',
|
||||
responsibleName: '',
|
||||
selectDeptId: '',
|
||||
@ -606,6 +619,7 @@ export default {
|
||||
this.formData = {
|
||||
department: row.departmentId || '', // 级联选择器需要部门ID
|
||||
subsystem: row.subsystem || '', // 子系统
|
||||
partsName: row.partsName || '', // 项目名称
|
||||
responsible: row.userNumber || row.userId || '', // 责任人 userNumber(用于 el-select 的 value)
|
||||
responsibleName: row.username || '', // 责任人姓名(用于显示)
|
||||
selectDeptId: row.departmentId || '', // 选中的部门ID(用于搜索责任人)
|
||||
@ -627,6 +641,7 @@ export default {
|
||||
this.formData = {
|
||||
department: '',
|
||||
subsystem: '',
|
||||
partsName: '',
|
||||
responsible: '',
|
||||
responsibleName: '',
|
||||
selectDeptId: '',
|
||||
@ -661,6 +676,7 @@ export default {
|
||||
subsystem: Array.isArray(this.formData.subsystem)
|
||||
? this.formData.subsystem.join(',')
|
||||
: this.formData.subsystem,
|
||||
partsName: this.formData.partsName || '',
|
||||
userId: this.formData.userId || this.formData.responsible
|
||||
},
|
||||
disableSuccessMsg: true
|
||||
@ -691,6 +707,7 @@ export default {
|
||||
subsystem: Array.isArray(this.formData.subsystem)
|
||||
? this.formData.subsystem.join(',')
|
||||
: this.formData.subsystem,
|
||||
partsName: this.formData.partsName || '',
|
||||
userId: this.formData.responsible,
|
||||
rowId: this.formData.rowId
|
||||
},
|
||||
@ -1330,7 +1347,7 @@ export default {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
font-size: 12px;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -208,7 +208,11 @@
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleAddModelDialogClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleConfirmAddModel">
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="loadingModelDetail"
|
||||
@click="handleConfirmAddModel"
|
||||
>
|
||||
确定
|
||||
</el-button>
|
||||
</span>
|
||||
@ -312,6 +316,10 @@ import api from '@/api'
|
||||
import { getUserId } from '@/utils'
|
||||
import '@/assets/scss/apaas-custom-hello.css'
|
||||
|
||||
/** 整车参数展示名称(接口可能仍返回「整车参数」) */
|
||||
const WHOLE_ENGINE_PARAMS_NAME = '发动机基本信息'
|
||||
const WHOLE_ENGINE_PARAMS_LEGACY_KEYS = ['整车参数', WHOLE_ENGINE_PARAMS_NAME]
|
||||
|
||||
export default {
|
||||
name: 'ModelQuery',
|
||||
data() {
|
||||
@ -926,7 +934,7 @@ export default {
|
||||
}
|
||||
|
||||
// 如果是"整车参数"子系统,且是特定的参数,直接从机型原始数据中获取
|
||||
if (param.subsystemName === '整车参数') {
|
||||
if (this.isWholeEngineSubsystemName(param.subsystemName)) {
|
||||
const paramNameToFieldMap = {
|
||||
产品型号: 'modelName',
|
||||
状态代号: 'productNumber',
|
||||
@ -1074,6 +1082,10 @@ export default {
|
||||
// }
|
||||
|
||||
this.loadingModelDetail = true
|
||||
const minLoadingMs = 1500
|
||||
const minLoadingPromise = new Promise((resolve) => {
|
||||
setTimeout(resolve, minLoadingMs)
|
||||
})
|
||||
// 获取当前选中的树节点对应的 subsystemTypes
|
||||
const { subsystemTypes } = this.getSelectedSubsystemsAndTypes()
|
||||
// 批量加载选中机型的详情
|
||||
@ -1098,7 +1110,7 @@ export default {
|
||||
return this.loadModelDetail(modelId, model, parameterVersion, subsystemTypes)
|
||||
})
|
||||
|
||||
Promise.all(loadPromises)
|
||||
Promise.all([Promise.all(loadPromises), minLoadingPromise])
|
||||
.then(() => {
|
||||
// this.$message.success('添加机型成功')
|
||||
this.handleAddModelDialogClose()
|
||||
@ -1530,7 +1542,7 @@ export default {
|
||||
const { subsystemTypes } = this.getSelectedSubsystemsAndTypes()
|
||||
// 过滤掉"整车参数"子系统,不包含在下载数据中
|
||||
const filteredSubsystemTypes = subsystemTypes.filter(
|
||||
(item) => !item.startsWith('整车参数-')
|
||||
(item) => !this.isWholeEngineSubsystemPrefix(item)
|
||||
)
|
||||
|
||||
// 构建参数ID数组,和"更新常用"中的parameters一样,但不包含整车参数
|
||||
@ -1539,7 +1551,7 @@ export default {
|
||||
if (saveData && saveData.subsystems && saveData.subsystems.length > 0) {
|
||||
saveData.subsystems.forEach((item) => {
|
||||
// 如果子系统是"整车参数",isGlobal为1,否则为0
|
||||
const isGlobal = item.subsystem === '整车参数' ? 1 : 0
|
||||
const isGlobal = this.isWholeEngineSubsystemName(item.subsystem) ? 1 : 0
|
||||
item.parameters.forEach((param) => {
|
||||
parameters.push({
|
||||
parameterId: param.parameterId,
|
||||
@ -1659,7 +1671,7 @@ export default {
|
||||
|
||||
if (isGlobal) {
|
||||
// 如果 isGlobal 为 1,该参数属于"整车参数"子系统
|
||||
targetSubsystemName = '整车参数'
|
||||
targetSubsystemName = WHOLE_ENGINE_PARAMS_NAME
|
||||
if (!subsystemPartsMap.has(targetSubsystemName)) {
|
||||
subsystemPartsMap.set(targetSubsystemName, new Set())
|
||||
}
|
||||
@ -1833,7 +1845,7 @@ export default {
|
||||
// 检查是否是 isGlobal 为 1 的参数(属于"整车参数"子系统)
|
||||
const isGlobal = p.isGlobal === 1 || p.isGlobal === '1'
|
||||
// 如果 isGlobal 为 1,该参数属于"整车参数"子系统,否则属于原子系统
|
||||
const targetSubsystemName = isGlobal ? '整车参数' : subsystemName
|
||||
const targetSubsystemName = isGlobal ? WHOLE_ENGINE_PARAMS_NAME : subsystemName
|
||||
|
||||
// 优先使用 parameterId,如果没有则使用 parameterName
|
||||
const key = p.parameterId || p.parameterName
|
||||
@ -2067,7 +2079,7 @@ export default {
|
||||
let parameters = []
|
||||
saveData.subsystems.forEach((item) => {
|
||||
// 如果子系统是"整车参数",isGlobal为1,否则为0
|
||||
const isGlobal = item.subsystem === '整车参数' ? 1 : 0
|
||||
const isGlobal = this.isWholeEngineSubsystemName(item.subsystem) ? 1 : 0
|
||||
item.parameters.forEach((param) => {
|
||||
parameters.push({
|
||||
parameterId: param.parameterId,
|
||||
@ -2162,7 +2174,7 @@ export default {
|
||||
let parameters = []
|
||||
saveData.subsystems.forEach((item) => {
|
||||
// 如果子系统是"整车参数",isGlobal为1,否则为0
|
||||
const isGlobal = item.subsystem === '整车参数' ? 1 : 0
|
||||
const isGlobal = this.isWholeEngineSubsystemName(item.subsystem) ? 1 : 0
|
||||
item.parameters.forEach((param) => {
|
||||
parameters.push({
|
||||
parameterId: param.parameterId,
|
||||
@ -2580,13 +2592,30 @@ export default {
|
||||
})
|
||||
return keys
|
||||
},
|
||||
// 根据接口返回的"整车参数"参数数据构建树结构
|
||||
isWholeEngineSubsystemName(name) {
|
||||
return WHOLE_ENGINE_PARAMS_LEGACY_KEYS.includes(name)
|
||||
},
|
||||
isWholeEngineSubsystemPrefix(item) {
|
||||
if (!item || typeof item !== 'string') {
|
||||
return false
|
||||
}
|
||||
return WHOLE_ENGINE_PARAMS_LEGACY_KEYS.some((key) => item.startsWith(`${key}-`))
|
||||
},
|
||||
getWholeEngineParametersList() {
|
||||
for (let i = 0; i < WHOLE_ENGINE_PARAMS_LEGACY_KEYS.length; i++) {
|
||||
const key = WHOLE_ENGINE_PARAMS_LEGACY_KEYS[i]
|
||||
if (this.allParametersData[key]) {
|
||||
return this.allParametersData[key]
|
||||
}
|
||||
}
|
||||
return []
|
||||
},
|
||||
// 根据接口返回的发动机基本信息参数数据构建树结构
|
||||
buildWholeEngineParamsNode() {
|
||||
const subsystemName = '整车参数'
|
||||
const subsystemName = WHOLE_ENGINE_PARAMS_NAME
|
||||
const parentId = 'parent-whole-engine-params'
|
||||
|
||||
// 从 allParametersData 中获取"整车参数"的参数列表
|
||||
const parameters = this.allParametersData[subsystemName] || []
|
||||
const parameters = this.getWholeEngineParametersList()
|
||||
|
||||
// 提取所有的partsName并去重(过滤掉'/'和空值)
|
||||
const partsNameSet = new Set()
|
||||
|
||||
@ -73,6 +73,7 @@
|
||||
:dispatch-type="dispatchType"
|
||||
:responsible-person-id="responsiblePersonId"
|
||||
:filled-by="filledBy"
|
||||
:from-done="true"
|
||||
:hide-operations="true"
|
||||
class="engine-detail-wrapper"
|
||||
@back="handleBackFromDetail"
|
||||
|
||||
@ -109,16 +109,19 @@
|
||||
>
|
||||
查看
|
||||
</a>
|
||||
<!-- <span v-if="row.distributeStatus != '部分分发' && hasEngineDataEditPermission() && row.versionNumber === 1" class="link-separator"></span> -->
|
||||
<!-- <a
|
||||
v-if="row.distributeStatus != '部分分发' && hasEngineDataEditPermission() && row.versionNumber === 1"
|
||||
<span
|
||||
v-if="row.distributeStatus === '未分发' && hasEngineDataEditPermission()"
|
||||
class="link-separator"
|
||||
></span>
|
||||
<a
|
||||
v-if="row.distributeStatus === '未分发' && hasEngineDataEditPermission()"
|
||||
href="javascript:void(0)"
|
||||
class="el-link el-link--primary"
|
||||
style="margin-left: 5px;"
|
||||
@click.stop="handleRowEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</a> -->
|
||||
</a>
|
||||
<span v-if=" (row.distributeStatus === '未分发' || row.distributeStatus === '部分分发') &&hasEngineDataEditPermission()" class="link-separator"></span>
|
||||
<a
|
||||
v-if=" (row.distributeStatus === '未分发' || row.distributeStatus === '部分分发') && hasEngineDataEditPermission()"
|
||||
@ -362,7 +365,7 @@ export default {
|
||||
label: '操作',
|
||||
customSlot: 'options',
|
||||
align: 'center',
|
||||
width: '160',
|
||||
width: '200',
|
||||
fixed: 'right'
|
||||
}
|
||||
],
|
||||
@ -782,6 +785,9 @@ export default {
|
||||
this.$refs.addEngineModelModal.showModal('竞品')
|
||||
},
|
||||
handleRowEdit(row) {
|
||||
if (row.distributeStatus !== '未分发') {
|
||||
return
|
||||
}
|
||||
this.$refs.addEngineModelModal.showModalForEdit('竞品', row)
|
||||
},
|
||||
handleAddSuccess() {
|
||||
|
||||
@ -213,6 +213,9 @@
|
||||
multiple
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
collapse-tags
|
||||
:max-collapse-tags="3"
|
||||
placeholder="请输入人员姓名进行搜索"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
@ -1769,18 +1772,18 @@ export default {
|
||||
)
|
||||
// 去重:使用 Map 确保每个 userId 只出现一次
|
||||
const optionsMap = new Map()
|
||||
// 先添加已选择的选项
|
||||
selectedOptions.forEach((opt) => {
|
||||
if (opt.userId) {
|
||||
optionsMap.set(opt.userId, opt)
|
||||
}
|
||||
})
|
||||
// 再添加新的搜索结果
|
||||
// 先添加搜索结果,保证匹配项显示在下拉框最前面
|
||||
filteredUsers.forEach((user) => {
|
||||
if (user.userId && !optionsMap.has(user.userId)) {
|
||||
optionsMap.set(user.userId, user)
|
||||
}
|
||||
})
|
||||
// 再添加已选择的选项(用于标签反显)
|
||||
selectedOptions.forEach((opt) => {
|
||||
if (opt.userId && !optionsMap.has(opt.userId)) {
|
||||
optionsMap.set(opt.userId, opt)
|
||||
}
|
||||
})
|
||||
this.personOptions = Array.from(optionsMap.values())
|
||||
this.personSearchLoading = false
|
||||
this.currentPersonRequest = null
|
||||
@ -2443,6 +2446,33 @@ export default {
|
||||
|
||||
// 人员选择下拉框样式(参考 modelDetail.vue)
|
||||
::v-deep .person-select {
|
||||
.el-select__input {
|
||||
display: inline-block !important;
|
||||
visibility: visible !important;
|
||||
opacity: 1 !important;
|
||||
flex: 1;
|
||||
min-width: 80px !important;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.el-select__tags {
|
||||
max-width: calc(100% - 30px);
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
max-width: 90px;
|
||||
|
||||
.el-select__tags-text {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
|
||||
.el-select-dropdown__item {
|
||||
display: flex !important;
|
||||
justify-content: space-between !important;
|
||||
|
||||
@ -109,16 +109,19 @@
|
||||
>
|
||||
查看
|
||||
</a>
|
||||
<!-- <span v-if="row.distributeStatus != '部分分发' && hasEngineDataEditPermission() && row.versionNumber === 1" class="link-separator"></span> -->
|
||||
<!-- <a
|
||||
v-if="row.distributeStatus != '部分分发' && hasEngineDataEditPermission() && row.versionNumber === 1"
|
||||
<span
|
||||
v-if="row.distributeStatus === '未分发' && hasEngineDataEditPermission()"
|
||||
class="link-separator"
|
||||
></span>
|
||||
<a
|
||||
v-if="row.distributeStatus === '未分发' && hasEngineDataEditPermission()"
|
||||
href="javascript:void(0)"
|
||||
class="el-link el-link--primary"
|
||||
style="margin-left: 5px;"
|
||||
@click.stop="handleRowEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</a> -->
|
||||
</a>
|
||||
<span v-if=" (row.distributeStatus === '未分发' || row.distributeStatus === '部分分发') &&hasEngineDataEditPermission()" class="link-separator"></span>
|
||||
<a
|
||||
v-if=" (row.distributeStatus === '未分发' || row.distributeStatus === '部分分发') && hasEngineDataEditPermission()"
|
||||
@ -364,7 +367,7 @@ export default {
|
||||
label: '操作',
|
||||
customSlot: 'options',
|
||||
align: 'center',
|
||||
width: '160',
|
||||
width: '200',
|
||||
fixed: 'right'
|
||||
}
|
||||
],
|
||||
@ -784,6 +787,9 @@ export default {
|
||||
this.$refs.addEngineModelModal.showModal('玉柴')
|
||||
},
|
||||
handleRowEdit(row) {
|
||||
if (row.distributeStatus !== '未分发') {
|
||||
return
|
||||
}
|
||||
this.$refs.addEngineModelModal.showModalForEdit('玉柴', row)
|
||||
},
|
||||
handleAddSuccess() {
|
||||
|
||||
@ -451,6 +451,7 @@ export default {
|
||||
// 如果是"填写发动机参数值",打开非分发模式(查看模式)
|
||||
// 如果是"管理员分发责任人",打开分发模式且是分发填写人(显示填写人列,调用UPDATE_PARAM接口)
|
||||
// 其他情况打开分发模式且是分发责任人
|
||||
// currentNode / ownerId / currentProcessor 会随 row 传入 engineDetail,用于「编制 + 当前处理人为本人」时选择 selectParamListAndModelForFilledBy
|
||||
this.currentEngineDetail = { ...row, id: row.modelId, todoId: row.id }
|
||||
this.todoId = row.id
|
||||
// 填写发动机参数值:非分发模式(只读),传递 filledBy
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user