去掉添加学员提交限制

This commit is contained in:
lpq
2023-02-26 16:01:25 +08:00
parent 42a243f417
commit 8f43e19938
5 changed files with 41 additions and 24 deletions

View File

@@ -352,7 +352,12 @@ const props = defineProps({
type: Number,
default: null,
},
activeKey1: {
type: String,
default: null,
},
});
console.log("props.activeKey1" + props.activeKey1)
// 获取项目学员;
const procurrentPage = ref(1);
const projectList = ref([]);
@@ -775,30 +780,33 @@ const submitAuth = () => {
};
function handleStageOk() {
debugger
// 判断添加人数是否已超过限制人数 限制 = 本次添加的人 + 原有的人
if (props.type === 1) {
let selectMember = 0;
if (activeKey.value === 4) { // 项目内选人
selectMember = selectsData.value.projectMemberList.length
} else if (activeKey.value === 1) {
selectMember = selectsData.value.studentList.length
} else if (activeKey.value === 2) {
selectMember = selectsData.value.groupList.length
} else if (activeKey.value === 3) {
selectMember = selectsData.value.deptList.length
}
if (props.groupMemberCount < selectMember + Number(props.groupMemberNumber)) {
return message.warning("添加小组学员超过最大值");
}
// 判断是否是组长,组长不能添加
const leaderArray = selectsData.value.projectMemberList.filter(item => item.isLeader === '1');
if (leaderArray.length > 0) {
return message.warning("当前选中学员"+leaderArray[0].realName+"已是小组长,请勿重复选择。");
}
// 对选中的人员进行判断是否已经分组了
let haveGroupNum = selectsData.value.projectMemberList.filter(item => item.groupId !== null);
if (haveGroupNum.length > 0) {
message.warning("部分学员已经有小组,再次添加会被添加到当前小组.");
if (props.groupMemberCount !== null) { // 只有添加组员的时候判断
let selectMember = 0;
if (activeKey.value === 4) { // 项目内选人
selectMember = selectsData.value.projectMemberList.length
} else if (activeKey.value === 1) {
selectMember = selectsData.value.studentList.length
} else if (activeKey.value === 2) {
selectMember = selectsData.value.groupList.length
} else if (activeKey.value === 3) {
selectMember = selectsData.value.deptList.length
}
if (props.groupMemberCount < selectMember + Number(props.groupMemberNumber)) {
return message.warning("添加小组学员超过最大值");
}
// 判断是否是组长,组长不能添加
const leaderArray = selectsData.value.projectMemberList.filter(item => item.isLeader === '1');
if (leaderArray.length > 0) {
return message.warning("当前选中学员"+leaderArray[0].realName+"已是小组长,请勿重复选择。");
}
// 对选中的人员进行判断是否已经分组了
let haveGroupNum = selectsData.value.projectMemberList.filter(item => item.groupId !== null);
if (haveGroupNum.length > 0) {
message.warning("部分学员已经有小组,再次添加会被添加到当前小组.");
}
}
}
stageVisible.value = false;