Files
fe-manage/src/components/project/BatchLecturer.vue
2024-11-18 19:13:04 +08:00

334 lines
7.3 KiB
Vue

<template>
<a-drawer
:visible="visible"
class="drawerStyle RouterFaceStus"
placement="right"
width="80%"
>
<div class="drawerMains">
<div class="headers">
<div class="headerTitle">{{ name }}</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="@/assets/images/basicinfo/close.png"
@click="closeDrawer"
/>
</div>
<div class="content">
<div class="box">
<div style="margin-bottom: 20px;font-size: 18px;font-weight: 700;">选择讲师费汇总:<span style="color:red;margin-left:20px;">{{levelPay||0}}</span></div>
<div class="table">
<a-table
:columns="columns"
:data-source="tableData"
:pagination="false"
:scroll="{ x: 'max-content' }"
row-key="id"
:loading="loading"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
>
<template #action="{ record }">
<div class="action">
<div style="color: #1890ff;cursor: pointer;" class="btn" v-if="selectedRowKeys.includes(record.id)" @click="removeList(record)">取消选择</div>
<div style="color: #1890ff;cursor: pointer;" class="btn" v-else @click="addList(record)">选择</div>
</div>
</template>
</a-table>
</div>
</div>
</div>
<div class="btnn">
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="queryDrawer">下一步</button>
</div>
</div>
</a-drawer>
</template>
<script setup lang="jsx">
import {computed, defineEmits,defineProps, ref, watch} from "vue";
import * as api from '@/api/Lecturer'
import { message } from "ant-design-vue";
const props = defineProps({
visible: {
type: Boolean,
default: false,
},
name:{
type: String,
default: ""
}
});
watch(()=>props.visible,(val)=>{
if(val){
loading.value = true
api.getListByStatus().then(res=>{
if(res.data.code == 200 ){
tableData.value = res.data.data
}else{
message.error(res.data.msg)
}
loading.value = false
}).catch(err=>{
message.error(err.data.msg)
loading.value = false
})
}
})
const loading = ref(false)
const selectedRowKeys = ref([])
const selectsData = ref([]);
const onSelectChange = (e, l) => {
selectedRowKeys.value = e
selectsData.value = l
}
const emit = defineEmits(['selectedRowKeys','update:visible'])
const addList = (item) => {
selectedRowKeys.value.push(item.id)
selectsData.value.push(item)
}
const levelPay = ref(0)
watch(()=>selectsData.value.length,(val)=>{
if(val){
levelPay.value = selectsData.value.reduce((a,b)=>{
return a + b.levelPay
},0)
}else{
levelPay.value = 0
}
})
const removeList = (item) => {
selectedRowKeys.value = selectedRowKeys.value.filter(t=> t != item.id)
selectsData.value = selectsData.value.filter(t=>t.id != item.id)
}
const columns = [
{
title: '讲师名称',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '讲师工号',
dataIndex: 'userNo',
key: 'userNo',
align: 'center',
},
{
title: '所属组织',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '讲师体系',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '讲师等级',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '发薪地',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '课程类型',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '课程名称',
dataIndex: 'courseName',
key: 'courseName',
align: 'center',
},
{
title: '授课/开发课程日期',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '授课/开发课程时长',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '参训人数',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '评分',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '课酬基准',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '计划费用',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '应发费用',
dataIndex: 'name',
key: 'name',
align: 'center',
},
{
title: '操作',
align: 'center',
fixed: 'right',
width: 100,
slots: { customRender: "action" },
},
]
const tableData = ref([])
const closeDrawer = () => {
emit("update:visible", false);
selectedRowKeys.value = []
selectsData.value = []
}
const queryDrawer = () => {
if(!selectedRowKeys.value.length){
message.error('请选择需要审批的数据')
return
}
emit("selectedRowKeys", selectedRowKeys.value)
// closeDrawer()
}
</script>
<style lang="scss" scoped>
.RouterFaceStus {
.drawerMains {
min-width: 600px;
margin: 0px 32px 0px 32px;
overflow-x: auto;
display: flex;
flex-direction: column;
.headers {
height: 73px;
border-bottom: 1px solid #e8e8e8;
display: flex;
justify-content: space-between;
align-items: center;
// background-color: red;
margin-bottom: 20px;
.headerTitle {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
// margin-left: 24px;
}
}
.content{
margin: 0 20px;
.head{
display: flex;
align-items: center;
overflow-x: auto;
.list{
display: flex;
align-items: center;
background-color: #666;
min-width: 260px;
padding: 20px 10px;
color: #ffffff;
border-radius:6px;
margin-right: 20px;
margin-bottom: 20px;
.left{
width: 35%;
text-align:right;
margin-right:30px;
.text{
margin-top:20px;
}
}
.right{
.text{
margin-top:20px;
}
}
}
.active{
background-color: #f5f5f5;
color: #000000;
}
}
.box{
.top{
display: flex;
align-items: center;
margin-bottom: 20px;
margin-top: 10px;
.item{
margin-right: 20px;
}
}
}
}
.btnn {
height: 72px;
width: 100%;
position: absolute;
bottom: 0;
left: 0;
z-index: 9;
display: flex;
align-items: center;
justify-content: end;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
background-color: #fff;
.btn1 {
width: 100px;
height: 40px;
border: 1px solid #4ea6ff;
border-radius: 8px;
color: #4ea6ff;
background-color: #fff;
cursor: pointer;
}
.btn2 {
cursor: pointer;
width: 100px;
height: 40px;
background: #4ea6ff;
border-radius: 8px;
border: 0;
margin-left: 15px;
color: #fff;
margin-right: 15px;
}
}
}
}
</style>