fix : 修复人员取消功能
This commit is contained in:
@@ -106,7 +106,7 @@
|
||||
</el-row>
|
||||
</el-form>
|
||||
<user-picker :multiple="false" ref="userPicker" title="请选择研发人员" v-model:value="userList"
|
||||
@ok="selectedResearchPersonnel"
|
||||
@ok="selectedResearchPersonnel" @cancelOrClear="researchPersonnelPickerCancel"
|
||||
:setNullToSelectList="true" :isResearch="true"/>
|
||||
|
||||
<div style="width:100%;text-align: center;padding: 10px">
|
||||
@@ -232,12 +232,12 @@ const selectProject=(row,index)=>{
|
||||
//先选择人员, 再选择项目: 再添加一行,重复操作
|
||||
const projectIdArray = formData.value.tableData.map(item => item.projectId)
|
||||
const researchPersonnelIdArray = formData.value.tableData.map(item => item.researchPersonnelId)
|
||||
console.log('projectIdArray',projectIdArray)
|
||||
console.log('researchPersonnelIdArray',researchPersonnelIdArray)
|
||||
// console.log('projectIdArray',projectIdArray)
|
||||
// console.log('researchPersonnelIdArray',researchPersonnelIdArray)
|
||||
const projectNumObj = getSelectProjectAndResearchPersonnelNum(projectIdArray)
|
||||
const researchPersonnelNumObj = getSelectProjectAndResearchPersonnelNum(researchPersonnelIdArray)
|
||||
let repeatProjectName=getProjectName(row.projectId)
|
||||
console.log('currentRow.value',currentRow.value)
|
||||
// console.log('currentRow.value',currentRow.value)
|
||||
for (let researchPersonnelIdKey in researchPersonnelNumObj) {//先判断人员是否重复
|
||||
if(currentRow.value.projectId){
|
||||
if(researchPersonnelNumObj[researchPersonnelIdKey]>1){
|
||||
@@ -263,21 +263,52 @@ const selectProject=(row,index)=>{
|
||||
// }
|
||||
// }
|
||||
}
|
||||
const selectedResearchPersonnel = (select) => {
|
||||
if (!select || select.length === 0) {
|
||||
return
|
||||
const researchPersonnelPickerCancel = (select) => {
|
||||
console.log('select',select)
|
||||
if(select.length>0){
|
||||
formData.value.tableData?.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = select[0].id
|
||||
item.researchPersonnel = select[0].name
|
||||
item.companyName = select[0].companyName
|
||||
item.accountType = select[0].accountType
|
||||
}
|
||||
})
|
||||
}else{
|
||||
formData.value.tableData?.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = ''
|
||||
item.researchPersonnel = ''
|
||||
item.companyName = ''
|
||||
item.accountType = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const selectedResearchPersonnel = (select) => {
|
||||
if(select.length>0){
|
||||
formData.value.tableData?.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = select[0].id
|
||||
item.researchPersonnel = select[0].name
|
||||
item.companyName = select[0].companyName
|
||||
item.accountType = select[0].accountType
|
||||
}
|
||||
})
|
||||
}else{
|
||||
formData.value.tableData?.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = ''
|
||||
item.researchPersonnel = ''
|
||||
item.companyName = ''
|
||||
item.accountType = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
formData.value.tableData.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = select[0].id
|
||||
item.researchPersonnel = select[0].name
|
||||
item.companyName = select[0].companyName
|
||||
item.accountType = select[0].accountType
|
||||
}
|
||||
})
|
||||
//以下是为" 同一项目下,同一人不能分摊多次 "
|
||||
const projectIdArray = formData.value.tableData.map(item => item.projectId)
|
||||
const researchPersonnelIdArray = formData.value.tableData.map(item => item.researchPersonnelId)
|
||||
const projectIdArray = formData.value.tableData?.map(item => item.projectId)
|
||||
const researchPersonnelIdArray = formData.value.tableData?.map(item => item.researchPersonnelId)
|
||||
const projectNumObj = getSelectProjectAndResearchPersonnelNum(projectIdArray)
|
||||
const researchPersonnelNumObj = getSelectProjectAndResearchPersonnelNum(researchPersonnelIdArray)
|
||||
let repeatProjectName=''
|
||||
|
||||
Reference in New Issue
Block a user