Merge pull request 'master' (#707) from master into prod

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/707
This commit is contained in:
2024-08-12 16:42:19 +00:00

View File

@@ -24,7 +24,7 @@
<el-table-column prop="projectId" label="项目名称" min-width="230">
<template #default="scope">
<el-form-item prop="time" :rules="scope.row.projectId?'1':rules.projectId">
<el-select v-model="scope.row.projectId" placeholder="请选择项目名称" clearable filterable>
<el-select v-model="scope.row.projectId" placeholder="请选择项目名称" clearable filterable @change="selectProject(scope.row,scope.$index)">
<el-option
v-for="item in nameOptions"
:key="item.value"
@@ -180,6 +180,7 @@ const opentionData = ref({})
const processInstanceData = ref()
const processDiagramViewer = ref(false)
const loading = ref(false)
const isRepeatResearchPersonnel = ref(false)
const showTable = ref(true)
const route = useRoute()
const router = useRouter()
@@ -211,7 +212,6 @@ const researchOptions = ref([])
const showPersonnelPicker = (row, index) => {
currentRow.value = row
currentIndex.value = index
console.log('row',row)
if (row.companyName&&row.researchPersonnelId) {
let userObj = {
id: row.researchPersonnelId,
@@ -227,6 +227,42 @@ const showPersonnelPicker = (row, index) => {
userPicker.value.showUserPicker()
})
}
const selectProject=(row,index)=>{
console.log('row,index',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)
const projectNumObj = getSelectProjectAndResearchPersonnelNum(projectIdArray)
const researchPersonnelNumObj = getSelectProjectAndResearchPersonnelNum(researchPersonnelIdArray)
let repeatProjectName=getProjectName(row.projectId)
console.log('currentRow.value',currentRow.value)
for (let researchPersonnelIdKey in researchPersonnelNumObj) {//先判断人员是否重复
if(currentRow.value.projectId){
if(researchPersonnelNumObj[researchPersonnelIdKey]>1){
ElNotification({
title: '警告',
message: `${repeatProjectName} 项目下,同一个研发人员不能分摊多次!`,
type: 'warning',
})
row.researchPersonnelId = ''
row.researchPersonnel = ''
row.companyName = ''
row.accountType = ''
}
}
}
// for (let projectIdKey in projectNumObj) {
// // console.log('projectNumObjKey', projectIdKey, projectNumObj[projectIdKey])
// if(projectNumObj[projectIdKey]>1){
// // console.log('getProjectName(projectIdKey)',getProjectName(projectIdKey))
// repeatProjectName=getProjectName(projectIdKey)
//
// }
// }
}
const selectedResearchPersonnel = (select) => {
if (!select || select.length === 0) {
return
@@ -254,7 +290,8 @@ const selectedResearchPersonnel = (select) => {
}
for (let researchPersonnelIdKey in researchPersonnelNumObj) {
// console.log('researchPersonnelIdKey', researchPersonnelIdKey, researchPersonnelNumObj[researchPersonnelIdKey])
if(researchPersonnelNumObj[researchPersonnelIdKey]>1&&repeatProjectName){
if(researchPersonnelNumObj[researchPersonnelIdKey]>1&&repeatProjectName&&currentRow.value.projectId){
isRepeatResearchPersonnel.value=true
ElNotification({
title: '警告',
message: `${repeatProjectName} 项目下,同一个研发人员不能分摊多次!`,
@@ -269,7 +306,6 @@ const selectedResearchPersonnel = (select) => {
}
})
}else{
userList.value = select
}
}