Files
fe-manage/src/components/drawers/SelFacet.vue
zhangyc 7c8ae62f70 bug
2022-12-14 07:27:04 +08:00

773 lines
19 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<a-drawer
:visible="selfacetVisible"
class="drawerStyle selfacetDrawer"
width="80%"
title="添加在线"
placement="right"
@after-visible-change="afterVisibleChange"
>
<div class="drawerMain">
<div class="header">
<div class="headerTitle">选择面授</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@click="closeDrawer"
/>
</div>
<div class="contentMain">
<div class="main_items">
<div class="mi_ipts">
<div class="mii_ipt">
<div class="ipt_name">课程信息</div>
<div class="fi_input">
<a-input
v-model:value="name"
style="width: 424px; height: 40px; border-radius: 8px;"
placeholder="请输入课程名称"
/>
</div>
</div>
<!--
<div class="mii_ipt">
<div class="ipt_name">课程状态</div>
<div class="select fitems">
<a-select
v-model:value="auditStatus"
dropdownClassName="dropdown-style"
style="width: 200px"
placeholder="请选择状态"
:options="options1"
allowClear
showSearch
>
</a-select>
</div>
</div>
-->
</div>
<div class="mi_btns">
<div class="btn btn1" @click="search">
<div class="search"></div>
<div class="btnText">搜索</div>
</div>
<div class="btn btn2" @click="reset">
<div class="search"></div>
<div class="btnText">重置</div>
</div>
</div>
</div>
<!--
<div class="main_notice">
<div class="mntc_left">
<div class="notice_icon"></div>
<div v-if="offcourse == null">
<span class="title"
>已选择 <span class="data">0</span> </span
>
</div>
<div v-else>
<span class="title"
>已选择 <span class="data">1</span> ;</span
>
<span class="title"
>课程编号
<span class="data">{{ offcourse.offcourseId }}</span>
</span>
<span class="title"
>名称
<span class="data">{{
offcourse.name
}}</span>
</span>
<span class="title"
>分类
<span class="data">{{
offcourse.categoryId
}}</span>
</span>
<span class="title"
>授课老师
<span class="data">{{
offcourse.teacherId
}}</span>
</span>
<span class="title"
>创建人
<span class="data">{{ offcourse.createUser }}</span>
</span>
</div>
</div>
</div>-->
<div class="main_table">
<a-table
class="ant-table-striped"
:row-class-name="
(_record, index) => (index % 2 === 1 ? 'table-striped' : null)
"
:row-selection="rowSelection"
:columns="columns1"
:data-source="classTableData"
:loading="tableDataTotal === -1 ? true : false"
:pagination="false"
/>
<div class="tableBox" style="margin-top: 85px;">
<div class="pa" style="display:flex;justify-content:center;">
<a-pagination
v-if="tableDataTotal > 10"
:showSizeChanger="false"
showQuickJumper="true"
hideOnSinglePage="true"
:pageSize="pageSize"
:current="currentPage"
:total="tableDataTotal"
class="pagination"
@change="changePaginationStu"
/>
</div></div>
</div>
</div>
<div class="main_btns">
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="submitCourse">确定</button>
</div>
</div>
</a-drawer>
</template>
<script>
//import { ApiFilled } from "@ant-design/icons-vue";
import {reactive, toRefs, computed} from "vue";
// import { planList } from "../../api/indexTaskadd";
//import {detail} from "../../api/indexCourse";
import {list} from "../../api/indexTaskadd";
const columns1 = [
// {
// title: "课程编号",
// title: "课程编号",
// width: "20%",
// dataIndex: "num",
// key: "num",
//// align: "center",
// },
{
title: "名称",
width: "30%",
dataIndex: "name",
key: "name",
},
{
title: "内容分类",
width: "15%",
dataIndex: "category",
key: "category",
align: "center",
},
{
title: "授课教师",
width: "15%",
dataIndex: "teacher",
key: "teacher",
align: "center",
},
{
title: "创建人",
width: "15%",
dataIndex: "creator",
key: "creator",
align: "center",
},
{
title: "发布时间",
width: "25%",
dataIndex: "time",
key: "time",
align: "center",
},
];
export default {
name: "SelFacet",
props: {
selfacetVisible: {
type: Boolean,
default: false,
},
chooseCourse: {
type: Number,
default: null,
},
chooseCourseName: {
type: String,
default: null,
},
titleTag: {
type: Boolean,
default: false,
},
},
setup(props, ctx) {
const state = reactive({
options2222: [
{
title: "领导力",
value: "100",
selectable: false,
children: [
{
title: "领导业务",
value: "1001",
},
{
title: "领导团队",
value: "1002",
},
{
title: "领导自我",
value: "1003",
},
],
},
{
title: "专业力",
value: "200",
selectable: false,
children: [
{
title: "研发",
value: "2001",
},
{
title: "产品和解决方案",
value: "2002",
},
{
title: "生产技术与制造",
value: "2003",
},
{
title: "供应链",
value: "2004",
},
{
title: "营销",
value: "2005",
},
{
title: "品质",
value: "2006",
},
{
title: "战略与企划",
value: "2007",
},
{
title: "流程管理",
value: "2008",
},
{
title: "业绩管理",
value: "2009",
},
{
title: "项目管理",
value: "20010",
},
{
title: "信息技术",
value: "20011",
},
{
title: "环境与安全",
value: "20012",
},
{
title: "人力资源",
value: "20013",
},
{
title: "企业文化",
value: "20014",
},
{
title: "品牌",
value: "20015",
},
{
title: "财务",
value: "20016",
},
{
title: "法务",
value: "20017",
},
{
title: "行政",
value: "20018",
},
{
title: "医工",
value: "20019",
},
],
},
{
title: "通用力",
value: "300",
selectable: false,
children: [
{
title: "职业操守与道德",
value: "3001",
},
{
title: "职业素养与技能",
value: "3002",
},
{
title: "规章制度",
value: "3003",
},
],
},
],
classTableData: [
// {
// key: "1",
// num: "JDF2022071100001",
// name: "时间管理课程",
// content: "通用力",
// teacher: "BOE教师",
// creator: "管理员",
// time: "2022-10-31 23:12:00",
// }
],
currentPage: 1,
tableDataTotal: null,
pageSize: 10,
valueClass: null, //课程编号
valueContent: null, //内容分类
selectedRows: [], //选择的数据
selectedRowKeys: [],
titleTag: false,
offcourse: null,
auditStatus: null,
name: null,
courseInfo: []
});
const rowSelection = computed(() => {
console.log(3333333333)
console.log(state.selectedRows)
return {
type: "radio",
selectedRowKeys: state.selectedRows,
onSelect: (selectedRows) => {
console.log('select')
state.chooseCourse = selectedRows.num;
state.chooseCourseName = selectedRows.name;
console.log(selectedRows, "==========", state.chooseCourse);
},
onChange: (selectedRows) => {
console.log('onChange')
state.selectedRows = selectedRows
},
}
})
const submitCourse=()=>{
state.chooseCourse && ctx.emit("update:chooseCourse", state.chooseCourse);
state.chooseCourseName && ctx.emit("update:chooseCourseName", state.chooseCourseName);
closeDrawer();
}
const closeDrawer = () => {
ctx.emit("update:selfacetVisible", false);
};
const afterVisibleChange = (bool) => {
if (bool) {
state.chooseCourse = props.chooseCourse;
state.chooseCourseName = props.chooseCourseName;
state.selectedRows = props.chooseCourse ? [props.chooseCourse] : [];
getClassList();
// getFaceInfo();
}
};
// const showDrawerSelFacet = () => {
// state.selfacetvisible = true;
// };
// const getFaceInfo = () => {
// detail({offcourseId: 36}).then((res) => {
// state.courseInfo = res.data.data;
// }).catch();
// }
//获取面授课列表
const getClassList = (obj) => {
let objn = obj || {
auditStatus: 2,
status: 1,
name: state.name,
pageNo: state.currentPage,
pageSize: state.pageSize
};
list(objn)
.then((res) => {
console.log('面授课列表', res.data.data);
let result = res.data.data;
state.tableDataTotal = result.total;
getClassData(result.rows);
})
.catch((err) => {
console.log("获取列表失败", err.data);
});
};
const getClassData = (tabledata) => {
let data = tabledata;
let tData =[];
let array = [];
data.map((value) => {
let obj = {
key: value.offcourseId,
num: value.offcourseId,
name: value.name || "-",
teacher: value.teacher || "-",
creator: value.createName || "-",
time: value.publishTime,
categoryId: value.categoryId,
category:"",
//需要判断content
};
let options = state.options2222;
for (let i = 0; i < options.value.length; i++) {
for (let j = 0; j < options.value[i].children.length; j++) {
if (
String(options.value[i].children[j].value) ===
String(value.categoryId)
) {
console.log();
value.category = options.value[i].children[j].title;
return false;
}
}
}
array.push(obj);
});
array.forEach((itm) => {
let options = state.options2222;
for (let i = 0; i < options.value.length; i++) {
for (let j = 0; j < options.value[i].children.length; j++) {
if (
String(options.value[i].children[j].value) ===
String(itm.categoryId)
) {
console.log("找到了",i);
itm.category = options.value[i].children[j].title;
tData.push(itm);
return false;
}
}
}
});
console.log("结果",tData);
state.classTableData = tData;
};
/**
const options1 = ref([
{
value: 0,
label: "未提交",
},
{
value: 1,
label: "待审核",
},
{
value: 2,
label: "已审核",
},
]);*/
const handleChange = (value, option) => {
console.log("改变了", value, option);
console.log(state.valueContent);
};
//搜索
const search = () => {
//重新获取列表
getClassList();
};
//重置
const reset = () => {
state.name = null;
state.auditStatus = null;
//重新获取列表
getClassList();
};
const changePaginationStu = (page) => {
state.currentPage = page;
getClassList();
};
return {
...toRefs(state),
// showDrawerSelFacet,
afterVisibleChange,
closeDrawer,
columns1,
getClassData,
handleChange,
reset,
getClassList,
changePaginationStu,
rowSelection,
search,
submitCourse,
// change,
};
},
};
</script>
<style lang="scss">
.ant-table-striped :deep(.table-striped) td {
background-color: #fafafa !important;
}
.selfacetDrawer {
.drawerMain {
.header {
height: 73px;
border-bottom: 1px solid #e8e8e8;
display: flex;
justify-content: space-between;
align-items: center;
.headerTitle {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-left: 24px;
}
}
.contentMain {
.main_items {
display: flex;
margin-bottom: 12px;
margin-top: 32px;
flex-wrap: wrap;
.mi_ipts {
display: flex;
margin-bottom: 20px;
.mii_ipt {
display: flex;
align-items: center;
margin-right: 24px;
.ipt_name {
white-space: nowrap;
}
}
}
.mi_btns {
display: flex;
margin-left: 38px;
margin-bottom: 20px;
cursor: pointer;
.btn {
padding: 0px 26px 0px 26px;
height: 38px;
border-radius: 8px;
border: 1px solid rgba(64, 158, 255, 1);
display: flex;
align-items: center;
justify-content: center;
margin-left: 14px;
flex-shrink: 0;
.search {
background-size: 100%;
}
.btnText {
font-size: 14px;
font-weight: 400;
line-height: 36px;
margin-left: 5px;
}
}
.btn1 {
background: rgb(64, 158, 255);
.search {
width: 15px;
height: 17px;
background-image: url("@/assets/images/coursewareManage/search0.png");
}
.btnText {
color: rgb(255, 255, 255);
}
}
.btn2 {
background: rgb(255, 255, 255);
.search {
width: 15px;
height: 17px;
background-image: url("@/assets/images/coursewareManage/reset1.png");
}
.btnText {
color: rgb(64, 158, 255);
}
}
.btn1:hover {
background: rgb(255, 255, 255);
.search {
background-image: url("@/assets/images/courseManage/search1.png");
}
.btnText {
color: #4ea6ff;
}
}
.btn2:hover {
background: rgba(64, 158, 255, 1);
.search {
background-image: url("@/assets/images/courseManage/reset0.png");
}
.btnText {
color: #ffffff;
}
}
}
}
.main_notice {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32px;
height: 40px;
background-color: #e9f6fe;
.mntc_left {
display: flex;
align-items: center;
.title {
color: rgba(0, 0, 0, 0.65);
margin-right: 17px;
}
.data {
color: #4ea6ff;
}
.notice_icon {
width: 14px;
height: 14px;
margin-right: 9px;
margin-left: 9px;
background-image: url(@/assets/images/coursewareManage/gan.png);
background-size: 100% 100%;
}
}
.mntc_right {
cursor: pointer;
}
}
}
.main_table {
position: relative;
padding-bottom: 80px;
.ant-checkbox-wrapper {
align-items: center;
margin-top: -2px;
}
.ant-table-selection-column {
padding: 0px !important;
padding-left: 5px !important;
}
.ant-table-thead > tr > th {
background-color: rgba(239, 244, 252, 1);
}
th.h {
background-color: #eff4fc !important;
}
.ant-table-tbody
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
> td {
background: #f6f9fd;
}
.pa {
left: 0;
width: 100%;
display: flex;
justify-content: center;
position: absolute;
bottom: 20px;
}
}
.main_btns {
height: 72px;
width: 100%;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
.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;
}
}
}
}
</style>