-- 学员选择bug

This commit is contained in:
yuping
2022-12-26 14:58:45 +08:00
parent 450ab28b65
commit b07b32098d
2 changed files with 136 additions and 85 deletions

View File

@@ -31,10 +31,19 @@ export function useBoeApiPage(_url, params = {}, config = {
}) })
} }
function reset(){
state.data = []
state.loading = false
state.page = 1
state.totalPage = 0
state.total = 0
}
config.init && fetch() config.init && fetch()
return { return {
...toRefs(state), ...toRefs(state),
fetch, fetch,
reset
}; };
} }

View File

@@ -3,20 +3,20 @@
<template> <template>
<div class="CommonStudent"> <div class="CommonStudent">
<a-drawer <a-drawer
:visible="visiable" :visible="visiable"
class="drawerStyle ProjCheckship CommonStudent" class="drawerStyle ProjCheckship CommonStudent"
placement="right" placement="right"
width="60%" width="60%"
> >
<div class="drawerMain" id="ProjCheckship" style=""> <div class="drawerMain" id="ProjCheckship" style="">
<div class="header"> <div class="header">
<div class="headerTitle"> <div class="headerTitle">
{{ { 1: "添加学员", 2: "添加学员", 3: "添加学员" }[type] || "" }} {{ {1: "添加学员", 2: "添加学员", 3: "添加学员"}[type] || "" }}
</div> </div>
<img <img
style="width: 29px; height: 29px; cursor: pointer" style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png" src="../../assets/images/basicinfo/close.png"
@click="closeDrawer" @click="closeDrawer"
/> />
</div> </div>
<div style="display: flex; overflow-x: auto; overflow-y: auto"> <div style="display: flex; overflow-x: auto; overflow-y: auto">
@@ -27,68 +27,70 @@
<div class="tab1"> <div class="tab1">
<a-form-item label="姓名"> <a-form-item label="姓名">
<a-input <a-input
v-model:value="nameSearch.keyword" v-model:value="nameSearch.keyword"
style="width: 270px; height: 40px; border-radius: 8px" style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入姓名" placeholder="请输入姓名"
/> />
<a-button <a-button
type="primary" type="primary"
@click="onSearchStu" @click="onSearchStu"
style="margin-left: 20px; border-radius: 4px" style="margin-left: 20px; border-radius: 4px"
> >
<template #icon> <template #icon>
<SearchOutlined /> <SearchOutlined/>
</template> </template>
搜索 搜索
</a-button> </a-button>
<a-button <a-button
@click="resetStu" @click="resetStu"
style="margin-left: 20px; border-radius: 4px" style="margin-left: 20px; border-radius: 4px"
>重置</a-button >重置
</a-button
> >
</a-form-item> </a-form-item>
</div> </div>
<div <div
class="chooseLeft" class="chooseLeft"
style="display: grid; grid-template-columns: 250px auto" style="display: grid; grid-template-columns: 250px auto"
> >
<div <div
:style="{ :style="{
height: screenHeight - 180 + 'px', height: screenHeight - 180 + 'px',
overflowY: 'auto', overflowY: 'auto',
}" }"
style="border: 1px solid #f0f0f0" style="border: 1px solid #f0f0f0"
> >
<div class="tree" style="margin: 10px 4px 220px 10px"> <div class="tree" style="margin: 10px 4px 220px 10px">
<a-tree <a-tree
allow-clear allow-clear
tree-default-expand-all tree-default-expand-all
:tree-data="treeData" :tree-data="treeData"
:fieldNames="{ v-model:selectedKeys="stuTreeSelectKeys"
:fieldNames="{
children: 'treeChildList', children: 'treeChildList',
key: 'id', key: 'id',
title: 'name', title: 'name',
value: 'name', value: 'name',
}" }"
@select="stuStuOrgSelect" @select="stuStuOrgSelect"
> >
</a-tree> </a-tree>
</div> </div>
</div> </div>
<div <div
class="tableBox tabb" class="tableBox tabb"
style=" style="
margin: 0px 4px 120px 10px; margin: 0px 4px 120px 10px;
border: 1px solid #f0f0f0; border: 1px solid #f0f0f0;
" "
> >
<a-table <a-table
:columns="stuColumns" :columns="stuColumns"
:data-source="stuData" :data-source="stuData"
:pagination="stuPagination" :pagination="stuPagination"
:loading="stuLoading" :loading="stuLoading"
row-key="id" row-key="id"
:row-selection="stuRowSelection" :row-selection="stuRowSelection"
/> />
</div> </div>
</div> </div>
@@ -137,36 +139,37 @@
<div> <div>
<a-form-item label="受众名称:"> <a-form-item label="受众名称:">
<a-input <a-input
v-model:value="audienceName.keyword" v-model:value="audienceName.keyword"
style="width: 260px; height: 40px; border-radius: 8px" style="width: 260px; height: 40px; border-radius: 8px"
placeholder="请输入受众名称" placeholder="请输入受众名称"
/> />
<a-button <a-button
type="primary" type="primary"
@click="searchAudi" @click="searchAudi"
style="margin-left: 20px; border-radius: 4px" style="margin-left: 20px; border-radius: 4px"
> >
<template #icon> <template #icon>
<SearchOutlined /> <SearchOutlined/>
</template> </template>
搜索 搜索
</a-button> </a-button>
<a-button <a-button
@click="resetAudienceInfo" @click="resetAudienceInfo"
style="margin-left: 20px; border-radius: 4px" style="margin-left: 20px; border-radius: 4px"
>重置</a-button >重置
</a-button
> >
</a-form-item> </a-form-item>
</div> </div>
<div class="tableBox tabb"> <div class="tableBox tabb">
<a-table <a-table
style="border: 1px solid #f2f6fe" style="border: 1px solid #f2f6fe"
row-key="id" row-key="id"
:columns="audiColums" :columns="audiColums"
:data-source="audiData" :data-source="audiData"
:loading="audiLoading" :loading="audiLoading"
:pagination="auditPagination" :pagination="auditPagination"
:row-selection="auditRowSelection" :row-selection="auditRowSelection"
/> />
</div> </div>
</div> </div>
@@ -180,9 +183,9 @@
</div> </div>
</div> </div>
<div <div
class="selecteds" class="selecteds"
:style="{ 'max-height': screenHeight - 235 + 'px' }" :style="{ 'max-height': screenHeight - 235 + 'px' }"
style="overflow-y: auto" style="overflow-y: auto"
> >
<div class="person">快速选人</div> <div class="person">快速选人</div>
<div v-for="(item, i) in selectsData.studentList"> <div v-for="(item, i) in selectsData.studentList">
@@ -202,14 +205,14 @@
</div> </div>
</div> </div>
<div <div
v-if="!person && selectsData.studentList.length > 10" v-if="!person && selectsData.studentList.length > 10"
class="ifsw" class="ifsw"
> >
<div @click="person = !person" class="“sw”">查看更多></div> <div @click="person = !person" class="“sw”">查看更多></div>
</div> </div>
<div <div
v-if="person && selectsData.studentList.length > 10" v-if="person && selectsData.studentList.length > 10"
class="ifsw" class="ifsw"
> >
<div @click="person = !person" class="sw">收起&lt;</div> <div @click="person = !person" class="sw">收起&lt;</div>
</div> </div>
@@ -254,8 +257,8 @@
</div> </div>
</div> </div>
<div <div
v-if="!group && selectsData.groupList.length > 10" v-if="!group && selectsData.groupList.length > 10"
class="ifsw" class="ifsw"
> >
<div @click="group = !group" class="“sw”">查看更多></div> <div @click="group = !group" class="“sw”">查看更多></div>
</div> </div>
@@ -341,7 +344,7 @@
<div class="con"> <div class="con">
<div class="header"> <div class="header">
<div class="inhe"> <div class="inhe">
<div class="tz"> {{ type === 1 ? "选择阶段" : "添加学员到关卡" }}</div> <div class="tz"> {{ type === 1 ? "选择阶段" : "添加学员到关卡" }}</div>
<div class="mg" @click="closeChangeModal"></div> <div class="mg" @click="closeChangeModal"></div>
</div> </div>
@@ -351,13 +354,13 @@
<!-- <div class="cur">当前关卡关卡2</div> --> <!-- <div class="cur">当前关卡关卡2</div> -->
<div class="select"> <div class="select">
<a-select <a-select
style="width: 400px" style="width: 400px"
:placeholder="type === 1 ? '选择阶段' : '选择关卡'" :placeholder="type === 1 ? '选择阶段' : '选择关卡'"
v-model:value="selectsData.stageId" v-model:value="selectsData.stageId"
className="cus-select" className="cus-select"
> >
<a-select-option v-for="(item, i) in stageIds" :key="i" :value="item.id" <a-select-option v-for="(item, i) in stageIds" :key="i" :value="item.id"
>{{ item.name || "默认" }} >{{ item.name || "默认" }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</div> </div>
@@ -384,14 +387,13 @@
</a-modal> </a-modal>
</template> </template>
<script setup> <script setup>
import { computed, defineEmits, defineProps, ref, watch } from "vue"; import {computed, defineEmits, defineProps, ref, watch} from "vue";
import { useStore } from "vuex"; import {useStore} from "vuex";
import { useBoeApiPage } from "@/api/request"; import {useBoeApiPage} from "@/api/request";
import { AUDIENCE_LIST, USER_LIST } from "@/api/ThirdApi"; import {AUDIENCE_LIST, USER_LIST} from "@/api/ThirdApi";
import { saveStu } from "@/api/index1"; import {saveStu} from "@/api/index1";
const store = useStore(); const store = useStore();
const emit = defineEmits({}); const emit = defineEmits({});
@@ -422,6 +424,7 @@ const nameSearch = ref({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
}); });
const stuTreeSelectKeys = ref([])
const audienceName = ref({ const audienceName = ref({
keyword: "", keyword: "",
page: 1, page: 1,
@@ -440,6 +443,7 @@ const {
pageSize: stuPageSize, pageSize: stuPageSize,
loading: stuLoading, loading: stuLoading,
total: stuTotal, total: stuTotal,
reset: stuReset
} = useBoeApiPage(USER_LIST, nameSearch.value, { } = useBoeApiPage(USER_LIST, nameSearch.value, {
init: false, init: false,
result: (res) => res.result.userInfoList, result: (res) => res.result.userInfoList,
@@ -457,10 +461,11 @@ const {
pageSize: audiPageSize, pageSize: audiPageSize,
loading: audiLoading, loading: audiLoading,
total: audiTotal, total: audiTotal,
reset: auditReset
} = useBoeApiPage(AUDIENCE_LIST, audienceName.value, { } = useBoeApiPage(AUDIENCE_LIST, audienceName.value, {
init: true, init: true,
result: (res) => 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, totalPage: (res) => res.result.totalPage,
total: (res) => res.result.totalElement, total: (res) => res.result.totalElement,
}); });
@@ -568,7 +573,7 @@ const auditRowSelection = computed(() => ({
const closeDrawer = () => { const closeDrawer = () => {
visiable.value = false; visiable.value = false;
stuData.value = []; stuData.value = [];
nameSearch.value.keyword =""; nameSearch.value.keyword = "";
}; };
@@ -582,30 +587,35 @@ const openDrawer = () => {
const treeData = computed(() => { const treeData = computed(() => {
return store.state.orgtreeList ? store.state.orgtreeList : []; return store.state.orgtreeList ? store.state.orgtreeList : [];
}); });
function onSearchStu() { function onSearchStu() {
nameSearch.value.page = 1; nameSearch.value.page = 1;
searchStu(); searchStu();
} }
function stuStuOrgSelect(e) { function stuStuOrgSelect(e) {
nameSearch.value.departId = e.join(""); nameSearch.value.departId = e.join("");
searchStu(); searchStu();
} }
function stuDel(i) { function stuDel(i) {
stuSelectKeys.value = stuSelectKeys.value.filter( 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); selectsData.value.studentList.splice(i, 1);
} }
// function orgDel(i) { // function orgDel(i) {
// orgSelectKeys.value = orgSelectKeys.value.filter(e => e !== selectsData.value.deptList[i].id) // orgSelectKeys.value = orgSelectKeys.value.filter(e => e !== selectsData.value.deptList[i].id)
// selectsData.value.deptList.splice(i, 1) // selectsData.value.deptList.splice(i, 1)
// } // }
function AuditDel(i) { function AuditDel(i) {
auditSelectKeys.value = auditSelectKeys.value.filter( 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); selectsData.value.groupList.splice(i, 1);
} }
// function orgSelect(key, obj) { // function orgSelect(key, obj) {
// console.log(obj) // console.log(obj)
//request(ORG_CHILD_LIST, {orgId: null}).then(res => { //request(ORG_CHILD_LIST, {orgId: null}).then(res => {
@@ -616,14 +626,17 @@ function onStuSelectChange(e, l) {
stuSelectKeys.value = e; stuSelectKeys.value = e;
selectsData.value.studentList = l; selectsData.value.studentList = l;
} }
function onOrgSelectChange(e, l) { function onOrgSelectChange(e, l) {
orgRowSelection.value = e; orgRowSelection.value = e;
selectsData.value.deptList = l.selectedNodes; selectsData.value.deptList = l.selectedNodes;
} }
function onAuditSelectChange(e, l) { function onAuditSelectChange(e, l) {
auditSelectKeys.value = e; auditSelectKeys.value = e;
selectsData.value.groupList = l; selectsData.value.groupList = l;
} }
// const stuDepartmentSelect = (e) => { // const stuDepartmentSelect = (e) => {
// nameSearch.value.orgId = e.join('') // nameSearch.value.orgId = e.join('')
// searchStu() // searchStu()
@@ -640,8 +653,8 @@ const auditChangePagination = (page) => {
//重置 //重置
const resetStu = () => { const resetStu = () => {
deleteDepSelect(); deleteDepSelect();
nameSearch.value = { keyword: "", page: 1, pageSize: 10 }; nameSearch.value = {keyword: "", page: 1, pageSize: 10};
stuReset()
}; };
//清空选择部门信息 //清空选择部门信息
const deleteDepSelect = () => { const deleteDepSelect = () => {
@@ -653,8 +666,9 @@ const deleteDepSelect = () => {
// }; // };
//重置受众 //重置受众
const resetAudienceInfo = () => { const resetAudienceInfo = () => {
audienceName.value = { keyword: "", page: 1, pageSize: 10 }; audienceName.value = {keyword: "", page: 1, pageSize: 10};
searchStu(); auditReset()
searchAudi()
}; };
//全部清除 //全部清除
// const deleteAll = () => { // const deleteAll = () => {
@@ -672,6 +686,7 @@ const submitAuth = () => {
handleStageOk(); handleStageOk();
} }
}; };
function handleStageOk() { function handleStageOk() {
stageVisible.value = false; stageVisible.value = false;
visiable.value = false; visiable.value = false;
@@ -687,23 +702,26 @@ function handleStageOk() {
emit("finash", true); emit("finash", true);
}); });
} }
watch(visiable, () => { watch(visiable, () => {
stuSelectKeys.value = []; stuSelectKeys.value = [];
orgSelectKeys.value = []; orgSelectKeys.value = [];
auditSelectKeys.value = []; auditSelectKeys.value = [];
stuData.value = [];
audienceName.value.keyword = ""; audienceName.value.keyword = "";
audienceName.value.page = 1; audienceName.value.page = 1;
audienceName.value.pageSize = 10; audienceName.value.pageSize = 10;
activeKey.value=1; nameSearch.value.departId = null
stuTreeSelectKeys.value=[]
activeKey.value = 1;
selectsData.value = { selectsData.value = {
stageId: "", stageId: "",
studentList: [], studentList: [],
deptList: [], deptList: [],
groupList: [], groupList: [],
}; };
stuReset()
auditReset()
searchAudi(); searchAudi();
}); });
</script> </script>
@@ -712,10 +730,12 @@ watch(visiable, () => {
.ant-btn-primary { .ant-btn-primary {
background-color: #4ea6ff !important; background-color: #4ea6ff !important;
} }
.cus-select { .cus-select {
height: 40px; height: 40px;
border-radius: 8px; border-radius: 8px;
} }
.tableBox .ant-table-row .ant-table-cell { .tableBox .ant-table-row .ant-table-cell {
height: 48px; height: 48px;
font-size: 14px; font-size: 14px;
@@ -724,18 +744,23 @@ watch(visiable, () => {
line-height: 29px; line-height: 29px;
padding: 0px; padding: 0px;
} }
.tableBox .ant-table-thead tr th { .tableBox .ant-table-thead tr th {
font-size: 14px; font-size: 14px;
} }
.ant-tabs-tabpane { .ant-tabs-tabpane {
height: 100%; height: 100%;
} }
.ant-tabs { .ant-tabs {
overflow: visible; overflow: visible;
} }
.right1 { .right1 {
border-left: 1px solid #f2f6fe; border-left: 1px solid #f2f6fe;
margin-left: 20px; margin-left: 20px;
.onerow { .onerow {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@@ -770,6 +795,7 @@ watch(visiable, () => {
font-weight: 500; font-weight: 500;
} }
} }
.clbox { .clbox {
margin-right: 50px; margin-right: 50px;
display: flex; display: flex;
@@ -780,6 +806,7 @@ watch(visiable, () => {
height: 32px; height: 32px;
border-radius: 4px; border-radius: 4px;
background: #4ea6ff; background: #4ea6ff;
.colose { .colose {
width: 16px; width: 16px;
height: 16px; height: 16px;
@@ -790,21 +817,25 @@ watch(visiable, () => {
background-size: 100%; background-size: 100%;
margin-right: 4px; margin-right: 4px;
} }
.allclear { .allclear {
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
font-size: 14px; font-size: 14px;
} }
} }
} }
.selecteds { .selecteds {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin-left: 32px; margin-left: 32px;
.person { .person {
width: 100%; width: 100%;
margin-top: 20px; margin-top: 20px;
border-top: 1px solid #f2f6fe; border-top: 1px solid #f2f6fe;
} }
.chose { .chose {
width: 64px; width: 64px;
height: 24px; height: 24px;
@@ -818,6 +849,7 @@ watch(visiable, () => {
color: rgba(56, 139, 225, 1); color: rgba(56, 139, 225, 1);
font-size: 12px; font-size: 12px;
position: relative; position: relative;
.ch { .ch {
position: absolute; position: absolute;
width: 18px; width: 18px;
@@ -827,12 +859,14 @@ watch(visiable, () => {
top: -8px; top: -8px;
} }
} }
.ifsw { .ifsw {
display: flex; display: flex;
align-items: end; align-items: end;
justify-content: center; justify-content: center;
color: #4ea6ff; color: #4ea6ff;
} }
.sw { .sw {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -842,11 +876,13 @@ watch(visiable, () => {
margin-top: 23px; margin-top: 23px;
margin-left: 10px; margin-left: 10px;
} }
.dept { .dept {
width: 100%; width: 100%;
margin-top: 30px; margin-top: 30px;
border-top: 1px solid #f2f6fe; border-top: 1px solid #f2f6fe;
} }
.chose1 { .chose1 {
//width: 90px; //width: 90px;
height: 24px; height: 24px;
@@ -860,11 +896,13 @@ watch(visiable, () => {
color: rgba(56, 139, 225, 1); color: rgba(56, 139, 225, 1);
font-size: 12px; font-size: 12px;
position: relative; position: relative;
.span { .span {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.ch1 { .ch1 {
position: absolute; position: absolute;
width: 18px; width: 18px;
@@ -874,11 +912,13 @@ watch(visiable, () => {
top: -8px; top: -8px;
} }
} }
.group { .group {
width: 100%; width: 100%;
margin-top: 30px; margin-top: 30px;
border-top: 1px solid #f2f6fe; border-top: 1px solid #f2f6fe;
} }
.chose2 { .chose2 {
//width: 120px; //width: 120px;
height: 24px; height: 24px;
@@ -892,11 +932,13 @@ watch(visiable, () => {
color: rgba(56, 139, 225, 1); color: rgba(56, 139, 225, 1);
font-size: 12px; font-size: 12px;
position: relative; position: relative;
.span { .span {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.ch2 { .ch2 {
position: absolute; position: absolute;
width: 18px; width: 18px;