-- fix bug

This commit is contained in:
yuping
2023-02-27 23:30:07 +08:00
parent a74d5a151b
commit c4f71e7521
2 changed files with 71 additions and 73 deletions

View File

@@ -9,7 +9,7 @@
{{ { 1: "添加学员", 2: "添加学员", 3: "添加学员" }[type] || title }}
</div>
<img style="width: 29px; height: 29px; cursor: pointer" src="../../assets/images/basicinfo/close.png"
@click="closeDrawer" />
@click="closeDrawer"/>
</div>
<div style="display: flex; overflow-x: auto; overflow-y: auto">
<div class="tabs" style="min-width: 800px">
@@ -19,10 +19,10 @@
<div>
<a-form-item label="姓名:">
<a-input v-model:value="proStudentName" style="width: 260px; height: 40px; border-radius: 8px"
placeholder="请输入姓名" />
placeholder="请输入姓名"/>
<a-button type="primary" @click="getStu" style="margin-left: 20px; border-radius: 4px">
<template #icon>
<SearchOutlined />
<SearchOutlined/>
</template>
搜索
</a-button>
@@ -32,8 +32,8 @@
</div>
<div class="tableBox tabb">
<a-table style="border: 1px solid #f2f6fe; width: 800px" row-key="id" :columns="stuColumns"
:data-source="projectList" :loading="projectListTotal" :pagination="projectPagination"
:row-selection="projectRowSelection" />
:data-source="projectList" :loading="projectListTotal" :pagination="projectPagination"
:row-selection="projectRowSelection"/>
</div>
</div>
</a-tab-pane>
@@ -42,10 +42,10 @@
<div class="tab1">
<a-form-item label="姓名">
<a-input v-model:value="nameSearch.keyword" style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入姓名" @change="peopleName" />
placeholder="请输入姓名" @change="peopleName"/>
<a-button type="primary" @click="onSearchStu" style="margin-left: 20px; border-radius: 4px">
<template #icon>
<SearchOutlined />
<SearchOutlined/>
</template>
搜索
</a-button>
@@ -60,8 +60,8 @@
}" style="border: 1px solid #f0f0f0">
<div class="tree" style="margin: 10px 4px 220px 10px">
<a-tree allow-clear tree-default-expand-all :tree-data="treeData" :loading="orgLoading"
:load-data="onLoadData" v-model:selectedKeys="stuTreeSelectKeys"
v-model:expandedKeys="stuTreeExpandedKeys" :fieldNames="{
:load-data="onLoadData" v-model:selectedKeys="stuTreeSelectKeys"
v-model:expandedKeys="stuTreeExpandedKeys" :fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
@@ -75,7 +75,7 @@
border: 1px solid #f0f0f0;
">
<a-table :columns="stuColumns" :data-source="stuData" :pagination="stuPagination"
:loading="stuLoading" row-key="id" :row-selection="stuRowSelection" />
:loading="stuLoading" row-key="id" :row-selection="stuRowSelection"/>
</div>
</div>
</div>
@@ -85,10 +85,11 @@
<div class="tab2">
<a-form-item label="组织:">
<a-input v-model:value="searchOrgName.keyword"
style="width: 230px; height: 40px; border-radius: 8px" placeholder="请输入组织" @click="orgValue"/>
style="width: 230px; height: 40px; border-radius: 8px" placeholder="请输入组织"
@click="orgValue"/>
<a-button type="primary" @click="searchOrg" style="margin-left: 20px; border-radius: 4px">
<template #icon>
<SearchOutlined />
<SearchOutlined/>
</template>
搜索
</a-button>
@@ -97,13 +98,14 @@
</a-form-item>
</div>
<div class="boeTree">
<a-tree v-model:selectedKeys="selectedOrgKeys" :tree-data="searchOrgName.keyword ? orgData : treeOrgData" @select="onOrgSelectChange"
:loading="orgOrgLoading" :load-data="onLoadOrgData" :fieldNames="{
<a-tree v-model:selectedKeys="selectedOrgKeys"
:tree-data="searchOrgName.keyword ? orgData : treeOrgData" @select="onOrgSelectChange"
:loading="orgOrgLoading" :load-data="onLoadOrgData" :fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
value: 'name',
}" row-key="id" :row-selection="orgRowSelection" multiple>
}" row-key="id" :row-selection="orgRowSelection" multiple>
</a-tree>
</div>
</div>
@@ -112,11 +114,12 @@
<div :style="{ height: screenHeight - 235 + 'px' }">
<div>
<a-form-item label="受众名称:">
<a-input v-model:value="audienceName.keyword" style="width: 260px; height: 40px; border-radius: 8px"
placeholder="请输入受众名称" />
<a-input v-model:value="audienceName.keyword"
style="width: 260px; height: 40px; border-radius: 8px"
placeholder="请输入受众名称"/>
<a-button type="primary" @click="searchAudi" style="margin-left: 20px; border-radius: 4px">
<template #icon>
<SearchOutlined />
<SearchOutlined/>
</template>
搜索
</a-button>
@@ -126,8 +129,8 @@
</div>
<div class="tableBox tabb">
<a-table style="border: 1px solid #f2f6fe; width: 800px" row-key="id" :columns="audiColums"
:data-source="audiData" :loading="audiLoading" :pagination="auditPagination"
:row-selection="auditRowSelection" />
:data-source="audiData" :loading="audiLoading" :pagination="auditPagination"
:row-selection="auditRowSelection"/>
</div>
</div>
</a-tab-pane>
@@ -255,7 +258,7 @@
</a-button>
</div>
<a-modal :style="{ padding: 0, position: relative, right: '-20%' }" :closable="true" :visible="stageVisible"
:footer="null" centered="true" @ok="handleStageOk" wrapClassName="changeModal">
:footer="null" centered="true" @ok="handleStageOk" wrapClassName="changeModal">
<div class="con">
<div class="header">
<div class="inhe">
@@ -267,18 +270,19 @@
<div class="inher">
<!-- <div class="cur">当前关卡关卡2</div> -->
<div class="select">
<a-select style="width: 400px" :placeholder="type === 1 ? '选择阶段' : '选择关卡'" v-model:value="selectsData.stageId"
className="cus-select">
<a-select style="width: 400px" :placeholder="type === 1 ? '选择阶段' : '选择关卡'"
v-model:value="selectsData.stageId"
className="cus-select">
<a-select-option v-for="(item, i) in stageIds" :key="i" :value="item.id">{{ item.name || "默认" }}
</a-select-option>
</a-select>
</div>
<span style="color: #999999; margin-left: 10px"><minus-circle-outlined />已在其他关卡的学员不会被添加到该关卡</span>
<span style="color: #999999; margin-left: 10px"><minus-circle-outlined/>已在其他关卡的学员不会被添加到该关卡</span>
<div class="btn" style="margin-top: 50px">
<button class="sameb btn1" @click="closeChangeModal" style="cursor: pointer">
取消
</button>
<button class="sameb btn2" @click="handleStageOk" style="cursor: pointer">
<button class="sameb btn2" @click="handleDialogOk" style="cursor: pointer">
确定
</button>
</div>
@@ -288,9 +292,9 @@
</a-modal>
</template>
<script setup>
import { message } from "ant-design-vue";
import { computed, defineEmits, defineProps, ref, watch } from "vue";
import { boeRequest, useBoeApi, useBoeApiPage } from "@/api/request";
import {message} from "ant-design-vue";
import {computed, defineEmits, defineProps, ref, watch} from "vue";
import {boeRequest, useBoeApi, useBoeApiPage} from "@/api/request";
import {
AUDIENCE_LIST,
ORG_CHILD_LIST,
@@ -303,6 +307,7 @@ import {
// addGroupMember,
getStuPage,
} from "@/api/index1";
import dialog from "@/utils/dialog";
// import { getProjStu } from "@/api/indexProjStu";
const emit = defineEmits({});
const props = defineProps({
@@ -357,7 +362,7 @@ const props = defineProps({
default: null,
},
});
console.log("props.activeKey1" + props.activeKey1)
console.log("props.activeKey1" + props.activeKey1);
// 获取项目学员;
const procurrentPage = ref(1);
const projectList = ref([]);
@@ -391,22 +396,22 @@ const getStu = () => {
console.log("获取项目学员", obj);
getStuPage(obj).then((res) => {
console.log("获取项目学员", res);
let arr = res.data.data.records;
let array = [];
arr.map((value) => {
let obj = {
id: value.id,
realName: value.studentName,
userNo: value.studentId,
isLeader: value.isLeader,
groupId: value.groupId,
orgName: value.studentOrgName ? value.studentOrgName : "-",
departName: value.studentDepartName ? value.studentDepartName : "-",
};
array.push(obj);
});
projectList.value = array;
projectListTotal.value = res.data.data.total;
let arr = res.data.data.records;
let array = [];
arr.map((value) => {
let obj = {
id: value.id,
realName: value.studentName,
userNo: value.studentId,
isLeader: value.isLeader,
groupId: value.groupId,
orgName: value.studentOrgName ? value.studentOrgName : "-",
departName: value.studentDepartName ? value.studentDepartName : "-",
};
array.push(obj);
});
projectList.value = array;
projectListTotal.value = res.data.data.total;
});
};
getStu();
@@ -414,6 +419,7 @@ const projectChangePagination = (page) => {
procurrentPage.value = page;
getStu();
};
function onProjectSelectChange(e, l) {
console.log("eeeee", e, l);
projectSelectKeys.value = e;
@@ -670,14 +676,14 @@ function stuDel(i) {
const selectedOrgKeys = ref([]);
watch(selectedOrgKeys, () => {
console.log('selectedKeys', selectedOrgKeys);
console.log("selectedKeys", selectedOrgKeys);
});
function orgDel(i) {
console.log(selectedOrgKeys.value)
orgSelectKeys.value = orgSelectKeys.value.filter(e => e !== selectsData.value.deptList[i].id)
selectedOrgKeys.value.splice(i, 1)
selectsData.value.deptList.splice(i, 1)
console.log(selectedOrgKeys.value);
orgSelectKeys.value = orgSelectKeys.value.filter(e => e !== selectsData.value.deptList[i].id);
selectedOrgKeys.value.splice(i, 1);
selectsData.value.deptList.splice(i, 1);
}
function AuditDel(i) {
@@ -777,6 +783,14 @@ const submitAuth = () => {
}
};
function handleDialogOk() {
if (selectsData.value.groupList.length || selectsData.value.deptList.length) {
dialog({ content: "您选择了组织或受众,此添加为异步添加,请稍后手动刷新学员!", ok: handleStageOk });
return;
}
handleStageOk();
}
function handleStageOk() {
// debugger
// 判断添加人数是否已超过限制人数 限制 = 本次添加的人 + 原有的人
@@ -784,21 +798,21 @@ function handleStageOk() {
if (props.groupMemberCount !== null) { // 只有添加组员的时候判断
let selectMember = 0;
if (activeKey.value === 4) { // 项目内选人
selectMember = selectsData.value.projectMemberList.length
selectMember = selectsData.value.projectMemberList.length;
} else if (activeKey.value === 1) {
selectMember = selectsData.value.studentList.length
selectMember = selectsData.value.studentList.length;
} else if (activeKey.value === 2) {
selectMember = selectsData.value.groupList.length
selectMember = selectsData.value.groupList.length;
} else if (activeKey.value === 3) {
selectMember = selectsData.value.deptList.length
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');
const leaderArray = selectsData.value.projectMemberList.filter(item => item.isLeader === "1");
if (leaderArray.length > 0) {
return message.warning("当前选中学员"+leaderArray[0].realName+"已是小组长,请勿重复选择。");
return message.warning("当前选中学员" + leaderArray[0].realName + "已是小组长,请勿重复选择。");
}
// 对选中的人员进行判断是否已经分组了
let haveGroupNum = selectsData.value.projectMemberList.filter(item => item.groupId !== null);