feat:接入添加小组成员数据

This commit is contained in:
lixg
2023-02-14 01:18:10 +08:00
parent e1a45d38e1
commit 1fcd299abc
5 changed files with 473 additions and 234 deletions

View File

@@ -3,97 +3,136 @@
<template>
<div class="CommonStudent">
<a-drawer
:visible="visiable"
class="drawerStyle ProjCheckship CommonStudent"
placement="right"
width="60%"
:visible="visiable"
class="drawerStyle ProjCheckship CommonStudent"
placement="right"
width="60%"
>
<div class="drawerMain" id="ProjCheckship" style="">
<div class="header">
<div class="headerTitle">
{{ {1: "添加学员", 2: "添加学员", 3: "添加学员"}[type] || title }}
{{ { 1: "添加学员", 2: "添加学员", 3: "添加学员" }[type] || title }}
</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@click="closeDrawer"
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@click="closeDrawer"
/>
</div>
<div style="display: flex; overflow-x: auto; overflow-y: auto">
<div class="tabs" style="min-width: 800px">
<a-tabs v-model:activeKey="activeKey">
<!-- <a-tab-pane v-if="isGroup" :key="4" tab="项目内学员">
<div :style="{ height: screenHeight - 235 + 'px' }">
<div>
<a-form-item label="姓名:">
<a-input
v-model:value="proStudentName"
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 />
</template>
搜索
</a-button>
<a-button
@click="resetAudienceInfo"
style="margin-left: 20px; border-radius: 4px"
>重置
</a-button>
</a-form-item>
</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"
/>
</div>
</div>
</a-tab-pane> -->
<a-tab-pane :key="1" tab="快速选人">
<div :style="{ height: screenHeight - 235 + 'px' }">
<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"
v-model:value="nameSearch.keyword"
style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入姓名"
@change="peopleName"
/>
<a-button
type="primary"
@click="onSearchStu"
style="margin-left: 20px; border-radius: 4px"
type="primary"
@click="onSearchStu"
style="margin-left: 20px; border-radius: 4px"
>
<template #icon>
<SearchOutlined/>
<SearchOutlined />
</template>
搜索
</a-button>
<a-button
@click="resetStu"
style="margin-left: 20px; border-radius: 4px"
>重置
@click="resetStu"
style="margin-left: 20px; border-radius: 4px"
>重置
</a-button>
</a-form-item>
</div>
<div
class="chooseLeft"
style="display: grid; grid-template-columns: 250px auto"
class="chooseLeft"
style="display: grid; grid-template-columns: 250px auto"
>
<div
:style="{
:style="{
height: screenHeight - 180 + 'px',
overflowY: 'auto',
}"
style="border: 1px solid #f0f0f0"
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="{
allow-clear
tree-default-expand-all
:tree-data="treeData"
:loading="orgLoading"
:load-data="onLoadData"
v-model:selectedKeys="stuTreeSelectKeys"
v-model:expandedKeys="stuTreeExpandedKeys"
:fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
value: 'name',
}"
@select="stuStuOrgSelect"
@select="stuStuOrgSelect"
>
</a-tree>
</div>
</div>
<div
class="tableBox tabb"
style="
class="tableBox tabb"
style="
margin: 0px 4px 120px 10px;
border: 1px solid #f0f0f0;
"
>
<a-table
:columns="stuColumns"
:data-source="stuData"
:pagination="stuPagination"
:loading="stuLoading"
row-key="id"
:row-selection="stuRowSelection"
:columns="stuColumns"
:data-source="stuData"
:pagination="stuPagination"
:loading="stuLoading"
row-key="id"
:row-selection="stuRowSelection"
/>
</div>
</div>
@@ -104,43 +143,42 @@
<div class="tab2">
<a-form-item label="组织:">
<a-input
v-model:value="searchOrgName.keyword"
style="width: 230px; height: 40px; border-radius: 8px"
placeholder="请输入组织"
v-model:value="searchOrgName.keyword"
style="width: 230px; height: 40px; border-radius: 8px"
placeholder="请输入组织"
/>
<a-button
type="primary"
@click="searchOrg"
style="margin-left: 20px; border-radius: 4px"
type="primary"
@click="searchOrg"
style="margin-left: 20px; border-radius: 4px"
>
<template #icon>
<SearchOutlined/>
<SearchOutlined />
</template>
搜索
</a-button>
<a-button
@click="resetOrg"
style="margin-left: 20px; border-radius: 4px"
>重置
</a-button
>
@click="resetOrg"
style="margin-left: 20px; border-radius: 4px"
>重置
</a-button>
</a-form-item>
</div>
<div class="boeTree">
<a-tree
:tree-data="searchOrgName.keyword ? orgData : treeOrgData"
@select="onOrgSelectChange"
:loading="orgOrgLoading"
:load-data="onLoadOrgData"
:fieldNames="{
: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>
@@ -151,36 +189,36 @@
<div>
<a-form-item label="受众名称:">
<a-input
v-model:value="audienceName.keyword"
style="width: 260px; height: 40px; border-radius: 8px"
placeholder="请输入受众名称"
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"
type="primary"
@click="searchAudi"
style="margin-left: 20px; border-radius: 4px"
>
<template #icon>
<SearchOutlined/>
<SearchOutlined />
</template>
搜索
</a-button>
<a-button
@click="resetAudienceInfo"
style="margin-left: 20px; border-radius: 4px"
>重置
@click="resetAudienceInfo"
style="margin-left: 20px; border-radius: 4px"
>重置
</a-button>
</a-form-item>
</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"
style="border: 1px solid #f2f6fe; width: 800px"
row-key="id"
:columns="audiColums"
:data-source="audiData"
:loading="audiLoading"
:pagination="auditPagination"
:row-selection="auditRowSelection"
/>
</div>
</div>
@@ -193,7 +231,10 @@
<div class="already">已选</div>
</div>
</div>
<div :style="{ 'max-height': screenHeight - 235 + 'px' }" style="overflow-y: auto">
<div
:style="{ 'max-height': screenHeight - 235 + 'px' }"
style="overflow-y: auto"
>
<div class="selecteds">
<div class="person">快速选人</div>
<div v-for="(item, i) in selectsData.studentList">
@@ -213,72 +254,78 @@
</div>
</div>
<div
v-if="!person && selectsData.studentList.length > 10"
class="ifsw"
v-if="!person && selectsData.studentList.length > 10"
class="ifsw"
>
<div @click="person = !person" class="“sw”">查看更多></div>
</div>
<div
v-if="person && selectsData.studentList.length > 10"
class="ifsw"
v-if="person && selectsData.studentList.length > 10"
class="ifsw"
>
<div @click="person = !person" class="sw">收起&lt;</div>
</div>
</div>
<div v-if="!selectStu" class="selecteds">
<div class="dept">添加组织</div>
<div v-for="(item,i) in selectsData.deptList">
<div v-if="i<11">
<div v-for="(item, i) in selectsData.deptList">
<div v-if="i < 11">
<div class="chose1">
<div class="span"> {{ item.name }}</div>
<div class="span">{{ item.name }}</div>
<div class="ch1" @click="orgDel(i)"></div>
</div>
</div>
<div v-else>
<div v-if="dept">
<div class="chose1">
<div class="span"> {{ item.name }}</div>
<div class="span">{{ item.name }}</div>
<div class="ch1" @click="orgDel(i)"></div>
</div>
</div>
</div>
</div>
<div v-if="!dept && selectsData.deptList.length >10" class="ifsw">
<div @click="dept = !dept" class=sw>查看更多></div>
<div
v-if="!dept && selectsData.deptList.length > 10"
class="ifsw"
>
<div @click="dept = !dept" class="“sw”">查看更多></div>
</div>
<div v-if="dept && selectsData.deptList.length >10" class="ifsw">
<div @click="dept = !dept" class="sw"> 收起&lt;</div>
<div
v-if="dept && selectsData.deptList.length > 10"
class="ifsw"
>
<div @click="dept = !dept" class="sw">收起&lt;</div>
</div>
</div>
<!--受众-->
<div v-if="!selectStu" class="selecteds">
<div class="group">受众关联</div>
<div v-for="(item, i) in selectsData.groupList">
<div v-if="i < 11">
<div class="chose2">
<div class="span">{{ item.audienceName }}</div>
<div class="ch2" @click="AuditDel(i)"></div>
</div>
</div>
<div v-else>
<div v-if="group">
<div class="chose2">
<div class="span">{{ item.audienceName }}</div>
<div class="ch2" @click="AuditDel(i)"></div>
</div>
</div>
</div>
</div>
<div
v-if="!group && selectsData.groupList.length > 10"
class="ifsw"
>
<div @click="group = !group" class="“sw”">查看更多></div>
</div>
<div v-if="group && selectsData.groupList > 10" class="ifsw">
<div @click="group = !group" class="sw">收起&lt;</div>
</div>
</div>
<div v-if="!selectStu" class="selecteds">
<div class="group">受众关联</div>
<div v-for="(item, i) in selectsData.groupList">
<div v-if="i < 11">
<div class="chose2">
<div class="span">{{ item.audienceName }}</div>
<div class="ch2" @click="AuditDel(i)"></div>
</div>
</div>
<div v-else>
<div v-if="group">
<div class="chose2">
<div class="span">{{ item.audienceName }}</div>
<div class="ch2" @click="AuditDel(i)"></div>
</div>
</div>
</div>
</div>
<div
v-if="!group && selectsData.groupList.length > 10"
class="ifsw"
>
<div @click="group = !group" class="“sw”">查看更多></div>
</div>
<div v-if="group && selectsData.groupList > 10" class="ifsw">
<div @click="group = !group" class="sw">收起&lt;</div>
</div>
</div>
</div>
</div>
</div>
@@ -291,13 +338,13 @@
<a-button @click="openDrawer" type="link"><slot></slot></a-button>
</div>
<a-modal
:style="{padding: 0,position: relative,right: '-20%'}"
:closable="true"
:visible="stageVisible"
:footer="null"
centered="true"
@ok="handleStageOk"
wrapClassName="changeModal"
:style="{ padding: 0, position: relative, right: '-20%' }"
:closable="true"
:visible="stageVisible"
:footer="null"
centered="true"
@ok="handleStageOk"
wrapClassName="changeModal"
>
<div class="con">
<div class="header">
@@ -311,34 +358,34 @@
<!-- <div class="cur">当前关卡关卡2</div> -->
<div class="select">
<a-select
style="width: 400px"
:placeholder="type === 1 ? '选择阶段' : '选择关卡'"
v-model:value="selectsData.stageId"
className="cus-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 || "默认" }}
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
><minus-circle-outlined />已在其他关卡的学员不会被添加到该关卡</span
>
<div class="btn" style="margin-top: 50px">
<button
class="sameb btn1"
@click="closeChangeModal"
style="cursor: pointer"
class="sameb btn1"
@click="closeChangeModal"
style="cursor: pointer"
>
取消
</button>
<button
class="sameb btn2"
@click="handleStageOk"
style="cursor: pointer"
class="sameb btn2"
@click="handleStageOk"
style="cursor: pointer"
>
确定
</button>
@@ -349,23 +396,27 @@
</a-modal>
</template>
<script setup>
import {computed, defineEmits, defineProps, ref, watch} from "vue";
import {boeRequest, useBoeApi, useBoeApiPage} from "@/api/request";
import { computed, defineEmits, defineProps, ref, watch } from "vue";
import { boeRequest, useBoeApi, useBoeApiPage } from "@/api/request";
import {
AUDIENCE_LIST,
ORG_CHILD_LIST,
ORG_LIST,
USER_LIST,
} from "@/api/ThirdApi";
import {saveStu} from "@/api/index1";
import {
saveStu,
// addGroupMember,
// getStuPage,
} from "@/api/index1";
// import { getProjStu } from "@/api/indexProjStu";
const emit = defineEmits({});
const props = defineProps({
type: Number,
id: String,
title: {
type: String,
default: '',
default: "",
},
clear: {
type: Boolean,
@@ -383,12 +434,85 @@ const props = defineProps({
type: Array,
default: () => [],
},
isGroup: {
type: Boolean,
default: false,
},
projectId: {
type: Number,
default: null,
},
groupId: {
type: Number,
default: null,
},
groupName: {
type: String,
default: null,
},
});
//获取项目学员
// const procurrentPage = ref(1);
// const projectList = ref([]);
// const proStudentName = ref("");
// const projectListTotal = ref(-1);
// const projectPageSize = ref(10);
// const projectSelectKeys = ref([]);
// const projectPagination = computed(() => ({
// total: projectListTotal.value,
// showSizeChanger: false,
// current: procurrentPage.value,
// pageSize: projectPageSize.value,
// onChange: projectChangePagination,
// }));
// const projectRowSelection = computed(() => ({
// columnWidth: 20,
// selectedRowKeys: projectSelectKeys.value,
// onChange: onProjectSelectChange,
// preserveSelectedRowKeys: true,
// }));
// const getStu = () => {
// let obj = {
// studentName: proStudentName.value,
// pageNo: procurrentPage.value,
// pageSize: 10,
// projectId: props.projectId,
// };
// projectListTotal.value = -1;
// console.log("获取项目学员", obj);
// getStuPage(obj).then((res) => {
// console.log("获取项目学员", res);
// if (res.data.code === 200) {
// let arr = res.data.data.records;
// let array = [];
// arr.map((value) => {
// let obj = {
// id: value.id,
// realName: value.studentName,
// userNo: value.studentId,
// orgName: value.studentOrgName ? value.studentOrgName : "-",
// departName: value.studentDepartName ? value.studentDepartName : "-",
// };
// array.push(obj);
// });
// projectList.value = array;
// projectListTotal.value = res.data.data.total;
// }
// });
// };
// getStu();
// const projectChangePagination = () => {};
// function onProjectSelectChange(e, l) {
// console.log("eeeee", e, l);
// projectSelectKeys.value = e;
// selectsData.value.projectMemberList = l;
// }
const person = ref(false);
// const dept =ref(false)
const group = ref(false);
const visiable = ref(false);
// const activeKey = ref(props.isGroup ? 4 : 1);
const activeKey = ref(1);
const stageVisible = ref(false);
const selectsData = ref({
@@ -411,10 +535,10 @@ const audienceName = ref({
pageSize: 10,
});
const searchOrgName = ref({
keyword: '',
keyword: "",
page: 1,
pageSize: 10
})
pageSize: 10,
});
const stageIds = computed(() => props.stage);
const {
data: stuData,
@@ -430,25 +554,25 @@ const {
totalPage: (res) => res.result.totalPage,
total: (res) => res.result.totalElement,
});
const {
data: orgData,
fetch: searchOrg,
} = useBoeApiPage(ORG_LIST, searchOrgName.value)
const {data: treeData, loading: orgLoading} = useBoeApi(
ORG_LIST,
{keyword: ""},
{
init: true,
result: (res) => res.result.map((e) => ({...e, isLeaf: false})),
}
const { data: orgData, fetch: searchOrg } = useBoeApiPage(
ORG_LIST,
searchOrgName.value
);
const {data: treeOrgData, loading: orgOrgLoading} = useBoeApi(
ORG_LIST,
{keyword: ""},
{
init: true,
result: (res) => res.result.map((e) => ({...e, isLeaf: false})),
}
const { data: treeData, loading: orgLoading } = useBoeApi(
ORG_LIST,
{ keyword: "" },
{
init: true,
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })),
}
);
const { data: treeOrgData, loading: orgOrgLoading } = useBoeApi(
ORG_LIST,
{ keyword: "" },
{
init: true,
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })),
}
);
const {
@@ -462,7 +586,7 @@ const {
} = useBoeApiPage(AUDIENCE_LIST, audienceName.value, {
init: true,
result: (res) =>
res.result.audienceList.map((e) => ({...e, id: e.id + ""})),
res.result.audienceList.map((e) => ({ ...e, id: e.id + "" })),
totalPage: (res) => res.result.totalPage,
total: (res) => res.result.totalElement,
});
@@ -537,7 +661,7 @@ const auditSelectKeys = ref([]);
const screenHeight = ref(document.body.clientHeight);
//const screenWidth = ref(document.body.clientWidth);
const stuRowSelection = computed(() => ({
type:props.selectOne?'radio':'checkbox',
type: props.selectOne ? "radio" : "checkbox",
columnWidth: 20,
selectedRowKeys: stuSelectKeys.value,
onChange: onStuSelectChange,
@@ -577,20 +701,20 @@ const closeDrawer = () => {
};
function onLoadData(treeNode) {
return boeRequest(ORG_CHILD_LIST, {keyword: "", orgId: treeNode.id}).then(
(r) => {
treeNode.dataRef.treeChildList = r.result.directChildList;
treeData.value = [...treeData.value];
}
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
(r) => {
treeNode.dataRef.treeChildList = r.result.directChildList;
treeData.value = [...treeData.value];
}
);
}
function onLoadOrgData(treeNode) {
return boeRequest(ORG_CHILD_LIST, {keyword: "", orgId: treeNode.id}).then(
(r) => {
treeNode.dataRef.treeChildList = r.result.directChildList;
treeOrgData.value = [...treeOrgData.value];
}
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
(r) => {
treeNode.dataRef.treeChildList = r.result.directChildList;
treeOrgData.value = [...treeOrgData.value];
}
);
}
@@ -617,7 +741,7 @@ function stuStuOrgSelect(e) {
function stuDel(i) {
stuSelectKeys.value = stuSelectKeys.value.filter(
(e) => e !== selectsData.value.studentList[i].id
(e) => e !== selectsData.value.studentList[i].id
);
selectsData.value.studentList.splice(i, 1);
}
@@ -628,7 +752,7 @@ function stuDel(i) {
// }
function AuditDel(i) {
auditSelectKeys.value = auditSelectKeys.value.filter(
(e) => e !== selectsData.value.groupList[i].id
(e) => e !== selectsData.value.groupList[i].id
);
selectsData.value.groupList.splice(i, 1);
}
@@ -690,7 +814,7 @@ const deleteDepSelect = () => {
};
//重置组织
const resetOrg = () => {
searchOrgName.value = {keyword: '', page: 1, pageSize: 10}
searchOrgName.value = { keyword: "", page: 1, pageSize: 10 };
};
//重置受众
const resetAudienceInfo = () => {
@@ -725,15 +849,42 @@ function handleStageOk() {
saveStu({
targetId: props.id,
type: props.type,
clear:props.clear,
clear: props.clear,
deptIds: selectsData.value.deptList?.map((e) => e.id),
stageId: selectsData.value.stageId,
groupIds: selectsData.value.groupList?.map((e) => e.id),
studentList: selectsData.value.studentList,
groupName: props.groupName,
groupId: props.groupId,
}).then(() => {
deleteDepSelect();
emit("finash", true);
});
// //添加小组学员
// if (props.isGroup) {
// console.log("添加组员传参", selectsData.value, {
// groupId: props.groupId,
// pid: props.projectId,
// groupName: props.groupName,
// ids: selectsData.value.studentList?.map((e) => e.id),
// });
// addGroupMember({
// groupId: props.groupId,
// pid: props.projectId,
// groupName: props.groupName,
// studentIds: selectsData.value.studentList?.map((e) => e.id),
// })
// .then((res) => {
// console.log("添加小组学员", res);
// deleteDepSelect();
// emit("finash", true);
// })
// .catch((err) => {
// console.log("添加小组学员失败", err);
// });
// } else {
// }
}
watch(visiable, () => {
@@ -746,6 +897,7 @@ watch(visiable, () => {
nameSearch.value.departId = null;
stuTreeExpandedKeys.value = [];
stuTreeSelectKeys.value = [];
// activeKey.value = props.isGroup ? 4 : 1;
activeKey.value = 1;
selectsData.value = {
stageId: "",