-- 添加学员

This commit is contained in:
yuping
2022-12-17 17:40:47 +08:00
parent 9090261a8f
commit c1983082a5
11 changed files with 1558 additions and 1603 deletions

View File

@@ -1,187 +1,195 @@
<template>
<a-drawer
:visible="visiableState"
class="drawerStyle ProjCheckship"
placement="right"
width="45%"
>
<div class="drawerMain" id="ProjCheckship">
<div class="header">
<div class="headerTitle">
{{ {1: '查看权', 2: '管理权', 3: '添加学员'}[type] || '' }}
<div>
<a-drawer
:visible="visiable"
class="drawerStyle ProjCheckship"
placement="right"
width="45%"
>
<div class="drawerMain" id="ProjCheckship">
<div class="header">
<div class="headerTitle">
{{ {1: '添加学员', 2: '添加学员', 3: '添加学员'}[type] || '' }}
</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@click="closeDrawer"
/>
</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@click="closeDrawer"
/>
</div>
<div style="width:100%;display: grid;grid-template-columns: 750px auto;">
<div class="tabs">
<a-tabs v-model:activeKey="activeKey">
<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="请输入姓名"
/>
<a-button type="primary" @click="onSearchStu" style="margin-left: 20px;border-radius: 4px">
<template #icon>
<SearchOutlined/>
</template>
搜索
</a-button>
<a-button @click="resetStu" style="margin-left: 20px;border-radius: 4px">重置</a-button>
</a-form-item>
<div style="width:100%;display: grid;grid-template-columns: 750px auto;">
<div class="tabs">
<a-tabs v-model:activeKey="activeKey">
<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="请输入姓名"
/>
<a-button type="primary" @click="onSearchStu" style="margin-left: 20px;border-radius: 4px">
<template #icon>
<SearchOutlined/>
</template>
搜索
</a-button>
<a-button @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">
<div :style="{ height: screenHeight - 235 + 'px' ,overflowY:'auto'}">
<a-tree
allow-clear
tree-default-expand-all
:tree-data="treeData"
:fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
value: 'name',
}"
@select="stuStuOrgSelect"
>
</a-tree>
</div>
<div class="tableBox tabb">
<a-table
:columns="stuColumns"
:data-source="stuData"
:pagination="stuPagination"
:loading="stuLoading"
row-key="id"
:row-selection="stuRowSelection"
/>
</div>
</div>
</div>
<div class="chooseLeft" style="display: grid;grid-template-columns: 250px auto">
<div :style="{ height: screenHeight - 235 + 'px' ,overflowY:'auto'}">
</a-tab-pane>
<a-tab-pane :key="2" tab="添加组织">
<div
:style="{ height: screenHeight - 235 + 'px' }"
>
<div class="tab2">
<a-form-item label="组织:">
<a-input
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">
<template #icon>
<SearchOutlined/>
</template>
搜索
</a-button>
<a-button @click="resetOrg" style="margin-left: 20px;border-radius: 4px">重置</a-button>
</a-form-item>
</div>
<div class="boeTree">
<a-tree
allow-clear
tree-default-expand-all
:tree-data="treeData"
:tree-data="searchOrgName.keyword ? orgData : treeData"
@select="onOrgSelectChange"
:fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
value: 'name',
}"
@select="stuStuOrgSelect"
row-key="id"
:row-selection="orgRowSelection"
multiple
>
</a-tree>
</div>
</div>
</a-tab-pane>
<a-tab-pane :key="3" tab="受众关联">
<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-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
:columns="stuColumns"
:data-source="stuData"
:pagination="stuPagination"
:loading="stuLoading"
style="border: 1px solid #f2f6fe"
row-key="id"
:row-selection="stuRowSelection"
:columns="audiColums"
:data-source="audiData"
:loading="audiLoading"
:pagination="auditPagination"
:row-selection="auditRowSelection"
/>
</div>
</div>
</div>
</a-tab-pane>
<a-tab-pane :key="2" tab="添加组织">
<div
:style="{ height: screenHeight - 235 + 'px' }"
>
<div class="tab2">
<a-form-item label="组织:">
<a-input
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">
<template #icon>
<SearchOutlined/>
</template>
搜索
</a-button>
<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 : treeData"
@select="onOrgSelectChange"
:fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
value: 'name',
}"
row-key="id"
:row-selection="orgRowSelection"
multiple
>
</a-tree>
<!-- <div>-->
<!-- <a-table-->
<!-- :columns="stuColumns"-->
<!-- :data-source="stuData"-->
<!-- :pagination="stuPagination"-->
<!-- :loading="orgLoading"-->
<!-- row-key="id"-->
<!-- :row-selection="stuRowSelection"-->
<!-- />-->
<!-- </div>-->
</div>
</div>
</a-tab-pane>
<a-tab-pane :key="3" tab="受众关联">
<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-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"
row-key="id"
:columns="audiColums"
:data-source="audiData"
:loading="audiLoading"
:pagination="auditPagination"
:row-selection="auditRowSelection"
/>
</div>
</div>
</a-tab-pane>
</a-tabs>
</div>
<div style="padding:100px 0 0 20px;display: grid;grid-template-rows: auto auto auto;">
<div>
<div style="margin-top: 20px">快速选人</div>
<a-tag :closable="true" color="#4ea6ff" @close="stuDel(i)" v-for="(item,i) in selectsData.studentList"
:key="i" style="margin-top:20px">
{{ item.realName }}
</a-tag>
</a-tab-pane>
</a-tabs>
</div>
<div>
<div style="margin-top: 20px">组织添加</div>
<a-tag :closable="true" color="#4ea6ff" @close="orgDel(i)" v-for="(item,i) in selectsData.deptList" :key="i"
style="margin-top:20px">
{{ item.name }}
</a-tag>
</div>
<div>
<div style="margin-top: 20px">受众添加</div>
<a-tag :closable="true" color="#4ea6ff" @close="AuditDel(i)" v-for="(item,i) in selectsData.groupList"
:key="i" style="margin-top:20px">
{{ item.audienceName }}
</a-tag>
<div style="padding:100px 0 0 20px;display: grid;grid-template-rows: auto auto auto;">
<div>
<div style="margin-top: 20px">快速选人</div>
<a-tag :closable="true" color="#4ea6ff" @close="stuDel(i)" v-for="(item,i) in selectsData.studentList"
:key="i" style="margin-top:20px">
{{ item.realName }}
</a-tag>
</div>
<div>
<div style="margin-top: 20px">组织添加</div>
<a-tag :closable="true" color="#4ea6ff" @close="orgDel(i)" v-for="(item,i) in selectsData.deptList"
:key="i"
style="margin-top:20px">
{{ item.name }}
</a-tag>
</div>
<div>
<div style="margin-top: 20px">受众添加</div>
<a-tag :closable="true" color="#4ea6ff" @close="AuditDel(i)" v-for="(item,i) in selectsData.groupList"
:key="i" style="margin-top:20px">
{{ item.audienceName }}
</a-tag>
</div>
</div>
</div>
<div class="btnn">
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="submitAuth">确定</button>
</div>
</div>
<div class="btnn">
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="submitAuth">确定</button>
</div>
</a-drawer>
<div @click="openDrawer">
<slot></slot>
</div>
</a-drawer>
</div>
<a-modal v-model:visible="stageVisible" width="1000px" title="选择阶段" @ok="handleStageOk">
<div>
{{ type === 1 ? '选择阶段' : '选择关卡' }}
<a-select style="width: 150px" :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>
</a-modal>
</template>
<script setup>
import {computed, defineEmits, defineProps, onMounted, ref} from "vue";
import {computed, defineEmits, defineProps, ref, watch} from "vue";
import {useStore} from "vuex";
import {useBoeApi, useBoeApiPage} from "@/api/request";
import {AUDIENCE_LIST, ORG_LIST, USER_LIST} from "@/api/ThirdApi";
@@ -191,16 +199,17 @@ const store = useStore();
const emit = defineEmits({})
const props = defineProps({
type: Number,
visiable: {
type: Boolean,
default: false
},
id: String,
stage: {
type: Array,
default: () => []
}
})
const visiableState = computed(() => props.visiable)
const visiable = ref(false)
const activeKey = ref(1)
const stageVisible = ref(false)
const selectsData = ref({
stageId: '',
studentList: [],
deptList: [],
groupList: []
@@ -222,6 +231,8 @@ const searchOrgName = ref({
pageSize: 10
})
const stageIds = computed(() => props.stage)
const {
data: stuData,
fetch: searchStu,
@@ -250,7 +261,7 @@ const {
total: audiTotal
} = useBoeApiPage(AUDIENCE_LIST, audienceName.value, {
init: true,
result: res => res.result.audienceList,
result: res => res.result.audienceList.map(e => ({...e, id: e.id + ''})),
totalPage: res => res.result.totalPage,
total: res => res.result.totalElement
})
@@ -367,11 +378,11 @@ const auditRowSelection = computed(() => ({
preserveSelectedRowKeys: true,
}))
onMounted(() => {
});
const closeDrawer = () => {
visiable.value = false
};
const openDrawer = () => {
visiable.value = true
};
//获取组织树
const treeData = computed(() => {
@@ -397,6 +408,7 @@ function AuditDel(i) {
auditSelectKeys.value = auditSelectKeys.value.filter(e => e !== selectsData.value.groupList[i].id)
selectsData.value.groupList.splice(i, 1)
}
//
// function orgSelect(key, obj) {
// console.log(obj)
@@ -432,8 +444,6 @@ const changePagination = (page) => {
};
const auditChangePagination = (page) => {
console.log(1111111111)
console.log(page)
audienceName.value.page = page;
searchAudi()
};
@@ -468,14 +478,50 @@ const resetAudienceInfo = () => {
// };
//确定添加授权
const submitAuth = () => {
emit('update:visiable', false)
saveStu(selectsData.value)
if (props.type !== 3) {
stageVisible.value = true
} else {
handleStageOk()
}
};
function handleStageOk() {
stageVisible.value = false
visiable.value = false
emit('finash', false)
saveStu({
targetId: props.id,
type: props.type,
deptIds: selectsData.value.deptList?.map(e => e.id),
stageId: selectsData.value.stageId,
groupIds: selectsData.value.groupList?.map(e => e.id),
studentList: selectsData.value.studentList
}).then(() => {
emit('finash', true)
})
}
watch(visiable, () => {
stuSelectKeys.value = []
orgSelectKeys.value = []
auditSelectKeys.value = []
selectsData.value = {
stageId: '',
studentList: [],
deptList: [],
groupList: []
}
})
</script>
<style>
.ant-btn-primary {
background-color: #4ea6ff !important;
}
.cus-select {
height: 40px;
border-radius: 8px;
}
</style>

View File

@@ -0,0 +1,213 @@
<template>
<div>
<a-row type="flex" gutter="12" style="padding-left: 20px">
<a-col>
<a-form-item title="姓名:" @click="getStuList">
<a-input class="cus-input" v-model:value="tableParam.studentName" placeholder="请输入姓名"/>
</a-form-item>
</a-col>
<a-col>
<a-button class="cus-btn" style="width: 100px">
<template #icon>
<img style="margin-right: 10px" src="../../assets/images/courseManage/search0.png"/></template>
搜索
</a-button>
</a-col>
<a-col :span="2">
<a-button class="cus-btn white" style="width: 100px" @click="reset">重置</a-button>
</a-col>
</a-row>
<a-row type="flex" gutter="12" style="padding-left: 20px">
<a-col :span="1.5">
<CommonStudent :type="type" :id="id" @finash="submitCall" :stage="stage">
<a-button class="cus-btn">
<template #icon><img style="margin-right: 10px" src="../../assets/images/courseManage/add0.png"/></template>
添加学员
</a-button>
</CommonStudent>
</a-col>
<a-col :span="1.5">
<a-button class="cus-btn white" @click="bathDel">
<template #icon><img style="margin-right: 10px" src="../../assets/images/projectadd/delete.png"/></template>
批量删除
</a-button>
</a-col>
</a-row>
<div style="margin-top: 20px">
<a-table
:columns="tablecolumns"
:data-source="tableData.list"
:pagination="stuPagination"
:loading="tableData.loading"
row-key="id"
:row-selection="stuRowSelection"
>
<template #action="{record}">
<a-row gutter="12">
<a-col>
<slot name="extension" v-bind:data="{record}"></slot>
</a-col>
<a-col>
<a-select style="width: 80px" value="更多">
<a-select-option value="删除" label="删除">
<div @click="del(record.id)">删除</div>
</a-select-option>
</a-select>
</a-col>
</a-row>
</template>
</a-table>
</div>
</div>
</template>
<script setup>
import {computed, defineProps, onMounted, ref, watch} from "vue";
import {delStudentList, getStuPage} from "@/api/index1";
import CommonStudent from '@/components/student/CommonStudent'
const props = defineProps({
type: Number,
id: String,
columns: {
type: Array,
default: () => []
},
stage: {
type: Array,
default: () => []
}
})
const tablecolumns = ref([
{
title: "姓名",
dataIndex: "studentName",
key: "studentName",
width: "20%",
align: "left",
className: "h",
},
{
title: "工号",
dataIndex: "studentUserNo",
key: "studentUserNo",
width: "10%",
align: "center",
className: "h",
ellipsis: true,
},
{
title: "部门",
dataIndex: "studentDepartName",
key: "studentDepartName",
width: "10%",
align: "center",
className: "h",
ellipsis: true,
},
{
title: "加入方式",
dataIndex: "source",
key: "source",
width: "10%",
align: "center",
customRender: ({record: {source}}) => ({1: '快速添加', 2: '组织', 3: '受众'}[source])
},
...props.columns,
{
title: "操作",
dataIndex: "operation",
key: "operation",
width: "25%",
align: "center",
slots: {customRender: 'action'}
},
]);
const tableParam = ref({
studentName: "",
pageNo: 1,
pageSize: 10,
type: props.type,
pid: props.id,
})
const stuSelectKeys = ref([])
const tableData = ref({
list: [],
total: 0,
loading: false
})
const stuRowSelection = computed(() => ({
columnWidth: 20,
selectedRowKeys: stuSelectKeys.value,
onChange: onStuSelectChange,
preserveSelectedRowKeys: true,
}))
onMounted(() => {
getStuList()
})
function onStuSelectChange(e) {
stuSelectKeys.value = e
}
const stuPagination = computed(() => ({
total: tableData.value.total,
showSizeChanger: false,
current: tableParam.value.pageNo,
pageSize: tableParam.value.pageSize,
onChange: changePagination
}))
function changePagination(page) {
tableParam.value.pageNo = page;
getStuList()
}
function getStuList() {
tableData.value.loading = true
getStuPage(tableParam.value).then(res => {
tableData.value.total = res.data.data.total;
tableData.value.list = res.data.data.records;
tableData.value.loading = false;
})
}
function reset() {
}
function bathDel() {
stuSelectKeys.value && stuSelectKeys.value.length && delStudentList({
ids: stuSelectKeys.value,
}).then(() => {
getStuList()
})
}
function del(id) {
id && delStudentList({
ids: [id],
}).then(() => {
getStuList()
})
}
function submitCall(flag) {
tableData.value.loading = true
flag && getStuList()
}
</script>
<style>
.studentopea1 {
font-size: 14px;
font-weight: 400;
color: #387df7;
line-height: 22px;
padding-right: 8px;
border-right: 1px solid #e9e9e9;
cursor: pointer;
}
</style>