mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 22:06:45 +08:00
1280 lines
38 KiB
Vue
1280 lines
38 KiB
Vue
<!-- 外部讲师页面 -->
|
||
<template>
|
||
<div>
|
||
<!-- 搜索框及按钮 -->
|
||
<div class="filter" >
|
||
<a-form layout="inline">
|
||
<a-form-item class="select">
|
||
<!-- v-model:value="searchParam.name" -->
|
||
<a-input v-model:value="searchParam.name" style="width: 250px; height: 40px; border-radius: 8px"
|
||
placeholder="请输入讲师姓名/手机号进行检索" allowClear showSearch
|
||
v-on:keydown.enter="enterPressHadlerSearch">
|
||
</a-input>
|
||
</a-form-item >
|
||
<a-form-item class="select">
|
||
<a-select style="width: 220px" v-model:value="searchParam.status" placeholder="账号状态"
|
||
:options="AccountStatusList"
|
||
v-on:keydown.enter="enterPressHadlerSearch">
|
||
</a-select>
|
||
</a-form-item >
|
||
<div style="display: flex; margin-bottom: 20px">
|
||
<a-button @click="searchSubmit()" type="primary" class="resetbtn">查询 </a-button>
|
||
<a-button class="resetbtn " @click="searchReset">重置</a-button>
|
||
</div>
|
||
</a-form>
|
||
<div style="width: 100%;"></div>
|
||
<div style="display: flex; margin-bottom: 20px">
|
||
<a-button @click="addTeacher()" type="primary" style="width:120px;" class="resetbtn">
|
||
<div class="search"></div> 新增讲师
|
||
</a-button>
|
||
<div>
|
||
<a-button @click="handleExport()" class="resetbtn">
|
||
<UploadOutlined /> 导出
|
||
</a-button>
|
||
</div>
|
||
</div>
|
||
<!-- 表格 -->
|
||
<div style="padding: 10px 0">
|
||
<a-table :header-cell-style="{ 'text-align': 'center' }" :columns="columns"
|
||
:data-source="tableData" :loading="tableLoading" :scroll="{ x: '900' }" :pagination="false">
|
||
<template #action="{ record, column }">
|
||
<a-space >
|
||
<a-button type="link" @click="() => handleLook(record, String(record.courseform))">查看</a-button>
|
||
<a-button type="link" @click="() => handleModify(record, String(record.courseform))">编辑</a-button>
|
||
<a-button v-if="record.status == '1'" type="link"
|
||
@click="() => handleOperate(record, String(record.courseform))">停用</a-button>
|
||
<a-button v-if="record.status == '2'" type="link"
|
||
@click="() => handleOperate(record, String(record.courseform))">启用</a-button>
|
||
<a-button type="link" v-if="record.isSuperPermission==='true'" @click="() => deleteModal(record, String(record.courseform))"
|
||
>删除</a-button>
|
||
<!-- <a-button type="link" @click="() => deleteModal(record, String(record.courseform))"
|
||
v-if="lecturerAdmin('Lecturer-admin')">删除</a-button> -->
|
||
</a-space>
|
||
</template>
|
||
</a-table>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="tableBox ">
|
||
<div class="pa">
|
||
<a-pagination v-if="tableDataTotal > 10" :showSizeChanger="true" :showQuickJumper="false"
|
||
:hideOnSinglePage="false" :pageSize="searchParam.pageSize" :current="searchParam.pageNo" :total="tableDataTotal"
|
||
class="pagination" @change="changePagination" />
|
||
</div>
|
||
</div>
|
||
<!-- 弹窗组件 -->
|
||
<a-drawer class="largeDrawerInside" v-model:visible="teacherdialog" placement="right" :closable="false" :maskClosable="false"
|
||
width="700px" :title="false">
|
||
<div style="padding:24px">
|
||
<div class="headers" style="margin-top:-24px;width: 110%;margin-left: -24px;">
|
||
<div class="headerTitle">{{ teacherdialogtitle }}</div>
|
||
<img
|
||
style="width: 29px; height: 29px; cursor: pointer;margin-right: 24px;"
|
||
src="@/assets/images/basicinfo/close.png"
|
||
@click="cancelTeacherDialog"
|
||
/>
|
||
</div>
|
||
<a-form style="padding-left:12px;padding-right: 46px;" :model="formParam" layout="vertical" ref="formRef" >
|
||
<!-- 基本信息 -->
|
||
<a-row>
|
||
<a-col :span="24">
|
||
<span class="line"></span><span style="font-weight: 600;">基本信息</span>
|
||
</a-col>
|
||
<!-- 头像 -->
|
||
</a-row>
|
||
<a-row :gutter="16">
|
||
<a-col :span="24">
|
||
<div class="item_inp" style="background-color: #fff;">
|
||
<a-upload name="avatar" list-type="picture-card" class="avatar-uploader" :show-upload-list="false"
|
||
:headers="headers" :before-upload="beforeUpload">
|
||
<img class="i_upload_img" v-if="formParam.photo" :src="formParam.photo" alt="avatar" title="更换头像" />
|
||
<img class="i_upload_img" v-else src="../../assets/Avatarman.png" alt="avatar" title="更换头像" />
|
||
<!-- <div class="i_upload" v-else>
|
||
<div class="addimg">
|
||
<div class="heng"></div>
|
||
<div class="shu"></div>
|
||
</div>
|
||
</div> -->
|
||
</a-upload>
|
||
<div class="i_bottom">
|
||
<div class="tip" style="margin-bottom: 10px;">
|
||
<span style="color: #999999; margin-left: 8px">支持图片格式为jpg/jpeg/png </span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</a-col>
|
||
</a-row>
|
||
<!-- 讲师名称 ,手机号码-->
|
||
<a-row :gutter="16">
|
||
<a-col :span="24">
|
||
<a-form-item name="name">
|
||
<template v-slot:label>
|
||
<img
|
||
style="margin-right:4px;width: 7px;height: 7px"
|
||
src="@/assets/images/coursewareManage/asterisk.png"
|
||
alt=""
|
||
/>
|
||
讲师姓名
|
||
</template>
|
||
<a-input v-model:value="formParam.name" class="draitem" :maxlength="20" showCount
|
||
@blur="sendName"
|
||
placeholder="请输入讲师姓名" allowClear showSearch>
|
||
</a-input>
|
||
</a-form-item>
|
||
</a-col>
|
||
<a-col :span="24">
|
||
<a-form-item name="supplier">
|
||
<template v-slot:label>
|
||
<img
|
||
style="margin-right:4px;width: 7px;height: 7px"
|
||
src="@/assets/images/coursewareManage/asterisk.png"
|
||
alt=""
|
||
/>
|
||
供应商
|
||
</template>
|
||
<a-input v-model:value="formParam.supplier" class="draitem" :maxlength="30" showCount
|
||
placeholder="请输入供应商" allowClear showSearch>
|
||
</a-input>
|
||
</a-form-item>
|
||
</a-col>
|
||
</a-row>
|
||
<!-- 供应商 ,邮箱-->
|
||
<a-row :gutter="16">
|
||
<a-col :span="24">
|
||
<a-form-item label="手机号码" name="mobile" prop="mobile">
|
||
<a-input type="number" v-model:value.trim="formParam.mobile" class="draitem"
|
||
placeholder="请输入手机号码" allowClear showSearch :maxLength="11" @blur="sendPhone">
|
||
</a-input>
|
||
</a-form-item>
|
||
</a-col>
|
||
<a-col :span="24">
|
||
<a-form-item label="讲师邮箱" name="email" prop="email">
|
||
<a-input v-model:value="formParam.email" type="email" class="draitem"
|
||
placeholder="请输入讲师邮箱" allowClear showSearch @blur="sendEmail">
|
||
</a-input>
|
||
</a-form-item>
|
||
</a-col>
|
||
<a-col :span="24">
|
||
<a-form-item label="初始授课时长" name="teaching">
|
||
<a-input v-model:value="formParam.teaching" style="width:100%; height: 40px; border-radius: 8px ; "
|
||
placeholder="0" allowClear showSearch suffix="分钟" @blur="clearNonNumber" @focus="focusTeaching">
|
||
</a-input>
|
||
<!-- <span style="margin-left: 5px ;" v-if="formParam.teaching !== null">{{ (formParam.teaching / 60
|
||
).toFixed(2) }}小时</span>
|
||
<span style="margin-left: 5px ;" v-if="formParam.teaching === null">0.00小时</span> -->
|
||
</a-form-item>
|
||
</a-col>
|
||
</a-row>
|
||
<!-- 其他信息 -->
|
||
<a-row>
|
||
<a-col :span="24" style="margin-bottom: 24px;margin-top: 12px;">
|
||
<span class="line"></span><span style="font-weight: 600;">其他信息</span>
|
||
</a-col>
|
||
</a-row>
|
||
<!-- 讲师介绍 -->
|
||
<a-row :gutter="16">
|
||
<a-col :span="24">
|
||
<a-form-item label="讲师介绍">
|
||
<Editor v-model:value="formParam.description "/>
|
||
<!-- <a-textarea placeholder="富文本"/> -->
|
||
|
||
</a-form-item>
|
||
</a-col>
|
||
</a-row>
|
||
<!-- 备注 -->
|
||
<a-row :gutter="16">
|
||
<a-col :span="24">
|
||
<a-form-item label="备注" style="margin-bottom: 80px;">
|
||
<a-textarea
|
||
v-model:value="formParam.remark"
|
||
showCount
|
||
:maxlength="200"
|
||
@blur="sendRemark"
|
||
style="width: 100%; height: 100px; border-radius: 8px"
|
||
placeholder="请输入"/>
|
||
</a-form-item>
|
||
</a-col>
|
||
</a-row>
|
||
</a-form>
|
||
<!-- 交互按钮 -->
|
||
<div
|
||
:style="{
|
||
position: 'absolute',
|
||
right: 0,
|
||
bottom: 0,
|
||
width: '100%',
|
||
borderTop: '1px solid #e9e9e9',
|
||
padding: '10px 16px',
|
||
background: '#fff',
|
||
textAlign: 'right',
|
||
zIndex: 1,
|
||
} "
|
||
>
|
||
<a-button class="drabtn" @click="cancelTeacherDialog" >取消</a-button>
|
||
<a-button style="margin-right: 20px;" class="drabtn" type="primary" @click="createTeacherDialog" :loading="buttonLoading">保存
|
||
</a-button>
|
||
</div>
|
||
</div>
|
||
</a-drawer>
|
||
|
||
<!-- 删除功能弹窗 -->
|
||
<div>
|
||
<a-modal v-model:visible="deleteTeacherdialog" :footer="null" :closable="close" wrapClassName="canclestu1"
|
||
centered="true">
|
||
<div class="delete">
|
||
<div class="del_header"></div>
|
||
<div class="del_main">
|
||
<div class="header">
|
||
<img src="@/assets/images/coursewareManage/QR.png" alt="" style="margin-right:5px"/>
|
||
<span>提示</span>
|
||
</div>
|
||
<div class="body">
|
||
<span>您确定要删除此讲师吗</span>
|
||
</div>
|
||
<div class="del_btnbox">
|
||
<div class="del_btn btn2" @click="cancelTeacherDialog1" style="margin-right: 32px">
|
||
<div class="btnText">取消</div>
|
||
</div>
|
||
<div class="del_btn btn2" @click="closeDeleteTeacher">
|
||
<div class="btnText">确定</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</a-modal>
|
||
</div>
|
||
<!-- 修改状态功能弹窗 -->
|
||
<div>
|
||
<a-modal v-model:visible="editTeacher" :footer="null" :closable="close" wrapClassName="canclestu1" centered="true">
|
||
<div class="delete">
|
||
<div class="del_header"></div>
|
||
<div class="del_main">
|
||
<div class="header">
|
||
<img src="@/assets/images/coursewareManage/QR.png" alt="" style="margin-right:10px"/>
|
||
<span>提示</span>
|
||
</div>
|
||
<div class="body">
|
||
<span v-if="handleOperate1 == 2">确定要将该讲师启用吗<div></div>启用后讲师可以登选为授课讲师</span>
|
||
<span v-if="handleOperate1 == 1">确定要将该讲师停用吗<div></div>停用后不可选为授课讲师</span>
|
||
</div>
|
||
<div class="del_btnbox">
|
||
<div class="del_btn btn2" @click="cancelTeacherDialog1" style="margin-right: 32px">
|
||
<div class="btnText">取消</div>
|
||
</div>
|
||
<div class="del_btn btn2" @click="closehandleOperate">
|
||
<div class="btnText">确定</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</a-modal>
|
||
</div>
|
||
<LookExternalLecturer v-model:visible="lookExternalVisi" :id="lookExterId"></LookExternalLecturer>
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</template>
|
||
<script lang="jsx">
|
||
import { reactive, toRefs, ref,watch ,computed,onMounted} from "vue";
|
||
import Editor from "@/components/project/Editor";
|
||
import { useRouter,useRoute } from "vue-router";
|
||
import { message } from "ant-design-vue";
|
||
import {
|
||
UploadOutlined,
|
||
FolderAddOutlined
|
||
} from '@ant-design/icons-vue';
|
||
import ProjectManager from "@/components/project/ProjectManagerNew";
|
||
import { getTeacherList, getTeacherById, deleteInTeacher, updateTeacherState, insertTeacher, updateInTeacher } from "../../api/Lecturer";
|
||
import { fileUp } from "../../api/indexEval";
|
||
import {getCookieForName} from "@/api/method"
|
||
import SearchTeacher from "@/components/project/SearchTeacher";
|
||
import avatar from '@/assets/avatar.png'
|
||
import LookExternalLecturer from "@/components/project/LookExternalLecturer";
|
||
export default {
|
||
name: "ExternalLecturer",
|
||
components: {
|
||
// AddTeacher,
|
||
SearchTeacher,
|
||
ProjectManager,
|
||
Editor,
|
||
FolderAddOutlined,//图标--新增
|
||
UploadOutlined,//图标--导出
|
||
LookExternalLecturer,
|
||
},
|
||
setup() {
|
||
onMounted(() => {
|
||
const search = sessionStorage.getItem('searchExter')
|
||
if(route.query.activeKey == 2&&search){
|
||
state.searchParam = JSON.parse(search)
|
||
}
|
||
searchSubmit()
|
||
})
|
||
const route = useRoute();
|
||
const formRef = ref();
|
||
const router = useRouter();
|
||
const userInfo = computed(() => store.state.userInfo);
|
||
const state = reactive({
|
||
phoneEmil: 0,
|
||
phoneEmilTwo: 0,
|
||
lookExternalVisi:false,
|
||
lookExterId: null,
|
||
currentPage1: 1,
|
||
pageSize1: 10,
|
||
close:false,
|
||
log:true,
|
||
promotionrecordsLoading: false, //晋级记录遮罩层
|
||
tableLoading: false,
|
||
tagsshow: "1",
|
||
delTeacherId: null, //删除id确认
|
||
editTeacherid: null,//修改状态id确认
|
||
userNoid: null, //讲师详情工号确认
|
||
id: null, //讲师详情id确认
|
||
newStatus: null, //修改状态码确认
|
||
deleteTeacherdialog: false, //删除弹窗
|
||
editTeacher: false, //修改状态弹窗
|
||
handleOperate1: null, //修改状态弹窗内容
|
||
teacherdialog: false, //控制讲师弹窗
|
||
teacherdialogtitle: '',//讲师弹框title内容
|
||
pageSizeOptions: ['10', '20', '30', '50'], //下拉选择每页显示多少条
|
||
pageSize: 10,
|
||
tableDataTotal: -1,//table列表总条数
|
||
teacherrecordstableDataTotal: -1,//授课记录列表总条数
|
||
tSystemNames:{
|
||
systemName:null,
|
||
levelVoList: []
|
||
},
|
||
formParam: {
|
||
description:"",
|
||
teacherType:'2',
|
||
photo:null,
|
||
status:1,
|
||
teaching:0,
|
||
},
|
||
vf:true,
|
||
searchParam: {
|
||
teacherType:2,
|
||
name: null,//姓名
|
||
status: null,//状态
|
||
tSystemName: null,
|
||
pageNo: 1,
|
||
pageSize: 10
|
||
},
|
||
activeName: 'first'
|
||
})
|
||
|
||
const headers = { token: getCookieForName("token") };
|
||
const beforeUpload = (file) => {
|
||
const isJpgOrPng =
|
||
file.type === "image/jpg" ||
|
||
file.type === "image/jpeg" ||
|
||
file.type === "image/png" ||
|
||
file.type === "image/bmp" ||
|
||
file.type === "image/gif";
|
||
if (!isJpgOrPng) {
|
||
message.error("仅支持jpg、gif、png、jpeg、bmp格式!");
|
||
return false;
|
||
}
|
||
let isLt1M = file.size < 500000;
|
||
console.log(file.size, isLt1M)
|
||
if (!isLt1M) {
|
||
message.error("图片不能超过500KB! 请重新上传");
|
||
return false;
|
||
}
|
||
|
||
const formDatas = new FormData();
|
||
formDatas.append("file", file);
|
||
console.log("file", file)
|
||
fileUp(formDatas).then((res) => {
|
||
if (res.data.code === 200) {
|
||
console.log(res.data.data, 45);
|
||
state.formParam.photo = process.env.VUE_APP_FILE_PATH + res.data.data;
|
||
|
||
// state.hasImgName = file.name;
|
||
// emit("src", { id: '', src: res.data.data });
|
||
}
|
||
});
|
||
return false;
|
||
};
|
||
const AccountStatusList = ref([
|
||
{ value: '', label: "全部" },
|
||
{ value: '1', label: "启用" },
|
||
{ value: '2', label: "停用" },
|
||
])
|
||
const columns = ref([
|
||
{
|
||
title: '讲师姓名 ',
|
||
dataIndex: 'name',
|
||
key: 'name',
|
||
ellipsis: true, align: "center",
|
||
width: 200,
|
||
},
|
||
{
|
||
title: '供应商',
|
||
dataIndex: 'supplier',
|
||
key: 'supplier',
|
||
ellipsis: true, align: "center",
|
||
width: 200,
|
||
},
|
||
{
|
||
title: '手机号码',
|
||
dataIndex: 'mobile',
|
||
key: 'mobile',
|
||
ellipsis: true, align: "center",
|
||
width: 200,
|
||
customRender: (value, record) => {
|
||
return (
|
||
<div>
|
||
{value.record.mobile||'-'}
|
||
</div>
|
||
)
|
||
}
|
||
},
|
||
// {
|
||
// title: '讲师邮箱 ',
|
||
// dataIndex: 'email',
|
||
// key: 'email',
|
||
// ellipsis: true, align: "center",
|
||
// width: 200,
|
||
// },
|
||
{
|
||
title: '授课时长 ',
|
||
dataIndex: 'teaching',
|
||
key: 'teaching',
|
||
ellipsis: true, align: "center",
|
||
width: 200,
|
||
customRender: (value, record) => {
|
||
return (
|
||
<div>
|
||
{value.record.teaching}分钟
|
||
</div>
|
||
)
|
||
}
|
||
},
|
||
{
|
||
title: '账号状态 ',
|
||
dataIndex: 'status',
|
||
key: 'status',
|
||
ellipsis: true, align: "center",
|
||
width: 200,
|
||
customRender: (value) => {
|
||
return (
|
||
<div>
|
||
{value.record.status == 0 || value.record.status == 1 || value.record.status == 2
|
||
? {
|
||
'0': "临时",
|
||
'1': "启用",
|
||
'2': "停用"
|
||
}[value.record.status + ""] || ""
|
||
: "-"}
|
||
</div>
|
||
)
|
||
}
|
||
},
|
||
{
|
||
title: '操作 ',
|
||
dataIndex: 'operation',
|
||
key: 'operation',
|
||
align: "right",
|
||
width: 200,
|
||
fixed: "right",
|
||
slots: { customRender: "action" },
|
||
},
|
||
])
|
||
//列表数据
|
||
const tableData = ref([
|
||
|
||
])
|
||
// 搜索
|
||
const searchSubmit = () => {
|
||
state.searchParam.pageNo = 1
|
||
getTableDate();
|
||
};
|
||
//重置
|
||
const searchReset = () => {
|
||
state.searchParam = {
|
||
pageNo: 1,
|
||
pageSize: 10,
|
||
teacherType:2,
|
||
name: null,
|
||
status: null
|
||
};
|
||
getTableDate();
|
||
};
|
||
// List接口数据
|
||
const getTableDate = () => {
|
||
state.tableLoading = true
|
||
state.loading = true;
|
||
let objA = { ...state.searchParam };
|
||
getTeacherList(objA)
|
||
.then((res) => {
|
||
tableData.value = res.data.data.records
|
||
state.tableDataTotal = Number(res.data.data.total);
|
||
state.tableLoading = false
|
||
// console.log("获取讲师tableDatateacherName", tableData);
|
||
})
|
||
.catch(err => {
|
||
state.tableLoading = false
|
||
message.error(err.data.msg)
|
||
})
|
||
};
|
||
// getTableDate()
|
||
// // 翻页
|
||
const changePagination = (page,pageSize) => {
|
||
state.searchParam.pageNo = page;
|
||
state.searchParam.pageSize = pageSize;
|
||
getTableDate();
|
||
};
|
||
// 新增讲师
|
||
const addTeacher = () => {
|
||
cancel()
|
||
state.phoneEmil = 0
|
||
state.phoneEmilTwo = 0
|
||
state.teacherdialog = true;
|
||
state.teacherdialogtitle = '新增讲师'
|
||
// state.formParam.photo =userInfo.value?.avatar
|
||
state.formParam.photo = null
|
||
state.vf = true
|
||
state.formParam.status = '1'
|
||
// state.formParam.photo = state.formParam.photo === null ?boe : state.formParam.photo
|
||
}
|
||
|
||
//修改讲师信息弹窗
|
||
const handleModify = (record) => {
|
||
state.phoneEmil = 0
|
||
state.phoneEmilTwo = 0
|
||
state.teacherdialog = true;
|
||
state.teacherdialogtitle = '编辑讲师'
|
||
state.id = record.id
|
||
state.vf = false
|
||
TeacherSystem()
|
||
}
|
||
async function validateField(name) {
|
||
return new Promise((resolve) => {
|
||
formRef.value.validateFields([name])
|
||
.then(() => {
|
||
resolve(false);
|
||
})
|
||
.catch(() => {
|
||
resolve(true);
|
||
});
|
||
});
|
||
}
|
||
//保存
|
||
const createTeacherDialog = async () => {
|
||
state.formParam.supplier = state.formParam?.supplier?.trim()
|
||
const formItemNames = Object.keys(rules);
|
||
for(let i=0;i<formItemNames.length;i++){
|
||
// const result = await validateField(formItemNames[i]);
|
||
const result = state.formParam[formItemNames[i]]
|
||
if (!result) {
|
||
return message.error(rules[formItemNames[i]][0].log)
|
||
}
|
||
}
|
||
if(state.phoneEmil){
|
||
message.destroy()
|
||
return message.warning( '手机号格式不正确')
|
||
}
|
||
if(state.phoneEmilTwo){
|
||
message.destroy()
|
||
return message.warning( '邮箱格式不正确')
|
||
}
|
||
state.formParam.description = repl(state.formParam.description)
|
||
state.formParam = {...state.formParam}
|
||
if (state.vf == false) {
|
||
updateInTeacher(state.formParam).then(response => {
|
||
message.success("编辑成功");
|
||
state.teacherdialog = false;
|
||
cancel()
|
||
getTableDate();
|
||
}).catch(err=>{
|
||
state.teacherdialog = false;
|
||
message.destroy()
|
||
message.error(err.data.msg)
|
||
})
|
||
}
|
||
else {
|
||
insertTeacher(state.formParam)
|
||
.then((res) => {
|
||
message.success("新增成功");
|
||
state.teacherdialog = false;
|
||
cancel()
|
||
getTableDate();
|
||
}).catch(err=>{
|
||
state.teacherdialog = false;
|
||
message.destroy()
|
||
message.error(err.data.msg)
|
||
})
|
||
}
|
||
};
|
||
//删除弹窗
|
||
const deleteModal = (record) => {
|
||
state.deleteTeacherdialog = true
|
||
state.delTeacherId = record.id
|
||
};
|
||
//修改状态窗口
|
||
const handleOperate = (record) => {
|
||
if (record.status == 1) {
|
||
state.handleOperate1 = record.status
|
||
state.newStatus = 2
|
||
}
|
||
if (record.status == 2) {
|
||
state.handleOperate1 = record.status
|
||
state.newStatus = 1
|
||
}
|
||
state.editTeacherid = record.id
|
||
state.editTeacher = true
|
||
};
|
||
|
||
//确认删除
|
||
const closeDeleteTeacher = () => {
|
||
//调用删除接口
|
||
deleteInTeacher(state.delTeacherId).then((res) => {
|
||
if (res.data.code == 200) {
|
||
message.success("删除成功");
|
||
state.deleteTeacherdialog = false
|
||
getTableDate();
|
||
}
|
||
})
|
||
.catch((err) => {
|
||
state.deleteTeacherdialog = false
|
||
});
|
||
}
|
||
//确认启用停用
|
||
const closehandleOperate = () => {
|
||
//调用接口
|
||
let ids = {
|
||
id: state.editTeacherid,
|
||
status: state.newStatus
|
||
}
|
||
console.log(ids)
|
||
updateTeacherState(ids).then((res) => {
|
||
// message.success("操作成功");
|
||
state.editTeacher = false
|
||
getTableDate();
|
||
})
|
||
.catch((err) => {
|
||
state.editTeacher = false
|
||
});
|
||
}
|
||
//取消按钮 清空输入的数据
|
||
const cancelTeacherDialog = () => {
|
||
if (state.teacherdialog = true) {
|
||
formRef.value.resetFields();
|
||
state.teacherdialog = false
|
||
cancel()
|
||
}
|
||
// state.deleteTeacherdialog = false
|
||
// state.editTeacher = false
|
||
// state.tagsshow = 1
|
||
};
|
||
const cancelTeacherDialog1 = () => {
|
||
state.deleteTeacherdialog = false
|
||
state.editTeacher = false
|
||
state.tagsshow = 1
|
||
};
|
||
watch(() => state.formParam.description, (val) => {
|
||
console.log(val, 'description')
|
||
})
|
||
//清空数据
|
||
const cancel = () => {
|
||
state.formParam = {
|
||
status:1,
|
||
teacherType:2,
|
||
photo:null,
|
||
teaching:0,
|
||
name: null,
|
||
mobile: null,
|
||
email: null,
|
||
teacherIntrofuce: null,
|
||
description:"",
|
||
remark: null,
|
||
id:null,
|
||
supplier:null,
|
||
}
|
||
console.log(state.formParam);
|
||
}
|
||
const rules = {
|
||
name: [{ required: true, message: '',log: '讲师不能为空' }],
|
||
supplier:[{ required: true, message: '',log:'供应商不能为空' }],
|
||
// email:[
|
||
// {
|
||
// type: "email",
|
||
// message: '',log: '请输入正确的邮箱地址',
|
||
// trigger: "blur"
|
||
// }
|
||
// ],
|
||
// mobile: [
|
||
// {
|
||
// pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||
// message: '',log: "请输入正确的手机号码",
|
||
// trigger: "blur"
|
||
// }
|
||
// ]
|
||
}
|
||
const rule =()=>{
|
||
if (state.formParam.name==null){
|
||
state.log = true
|
||
message.warning( '讲师不能为空')
|
||
}
|
||
if (state.formParam.supplier==null){
|
||
state.log = true
|
||
message.warning( '供应商不能为空')
|
||
}
|
||
}
|
||
// const sendEmail= ()=>{
|
||
// let regEmail=
|
||
// /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-A-Za-z0-9_-]+(\.[a-a-A-Za-z0-9_-]+)+$/
|
||
// }
|
||
//表格内查看数据操作
|
||
const handleLook = (record) => {
|
||
state.lookExternalVisi = true
|
||
state.lookExterId = record.id
|
||
// sessionStorage.setItem('searchExter', JSON.stringify(state.searchParam))
|
||
// let id = record.id
|
||
// router.push({ path: '/LookExternalLecturer', query: { id } })
|
||
}
|
||
//外部讲师详情
|
||
const TeacherSystem = () => {
|
||
getTeacherById({id:state.id}).then((res) => {
|
||
console.log("外部讲师详情", res.data);
|
||
state.formParam = res.data.data
|
||
state.formParam.description = state.formParam.description == null ? '<p><br></p>' : state.formParam.description
|
||
state.formParam.photo = state.formParam.photo == null ? null : state.formParam.photo.includes('upload') ? res.data.data.photo : '/upload'+res.data.data.photo
|
||
})
|
||
.catch((err) => {
|
||
message.destroy()
|
||
message.error(err.data.msg)
|
||
console.log("外部讲师详情", err);
|
||
});
|
||
}
|
||
const sendName=()=>{
|
||
// const reg = /\s/g;
|
||
// if (!state.formParam.name) {
|
||
// } else if (!reg.test(state.formParam.name)) {
|
||
// state.formParam.mobile='2'
|
||
// // state.formParam.mobile = state.formParam.mobile.replace(/\D/g, '');
|
||
// }
|
||
state.formParam.name = state.formParam?.name?.replace(/\s/g, '');
|
||
}
|
||
const sendPhone=()=>{
|
||
state.phoneEmil = 0
|
||
console.log(state.formParam.mobile)
|
||
const reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
|
||
if (!state.formParam.mobile) {
|
||
} else if (!reg.test(state.formParam.mobile)) {
|
||
message.warning( '手机号格式不正确')
|
||
// state.formParam.mobile=''
|
||
state.phoneEmil = 1
|
||
// state.formParam.mobile = state.formParam.mobile.replace(/\D/g, '');
|
||
}
|
||
|
||
}
|
||
const sendEmail=()=>{
|
||
state.phoneEmilTwo = 0
|
||
const reg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.\w{2,}$/;
|
||
if(!state.formParam.email){
|
||
return
|
||
}
|
||
if (!reg.test(state.formParam.email)) {
|
||
message.warning( '邮箱格式不正确')
|
||
// state.formParam.email=''
|
||
state.phoneEmilTwo = 2
|
||
// state.formParam.email = state.formParam.email.replace( /[\u4e00-\u9fa5]/g, '');
|
||
}
|
||
}
|
||
const clearNonNumber = () => {
|
||
state.formParam.teaching = state.formParam.teaching?.replace(/\D/g, '');
|
||
state.formParam.teaching = state.formParam.teaching?.slice(0,8)
|
||
!state.formParam.teaching && (state.formParam.teaching = 0)
|
||
}
|
||
const focusTeaching = () => {
|
||
state.formParam.teaching == 0 && (state.formParam.teaching = null)
|
||
}
|
||
const sendRemark=()=>{
|
||
state.formParam.remark = state.formParam.remark?.replace(/\s/g, '');
|
||
}
|
||
const repl = (val) => {
|
||
if(val){
|
||
val = val?.replace(/\s* \s*/g, '')
|
||
val = val?.replace(/\s+/g, '')
|
||
return val
|
||
}
|
||
}
|
||
// getpromotionrecordstableData()
|
||
//导出功能
|
||
const handleExport = () => {
|
||
window.open(
|
||
`${process.env.VUE_APP_BASE_API}/admin/export/exportOutTeacher?name=${state.searchParam.name || ""}&status=${state.searchParam.status || ""}`
|
||
);
|
||
// this.download('lesson_records/export', {
|
||
// ...state.searchParam
|
||
// }, `project_${new Date().getTime()}.xlsx` )
|
||
}
|
||
const lecturerAdmin = (admin)=>{
|
||
const roleCode = userInfo.value.roleList.map((item)=>item.roleCode)
|
||
if (admin){
|
||
return roleCode.some(t => t == admin)
|
||
}
|
||
}
|
||
//回车
|
||
const enterPressHadlerSearch = e => {
|
||
console.log("e",e);
|
||
if (e.keyCode === 13) {
|
||
searchSubmit()
|
||
|
||
}
|
||
};
|
||
return {
|
||
...toRefs(state),
|
||
lecturerAdmin,
|
||
clearNonNumber,
|
||
focusTeaching,
|
||
enterPressHadlerSearch,
|
||
validateField,
|
||
rules,
|
||
rule,
|
||
formRef,
|
||
repl,
|
||
sendName,
|
||
sendPhone,
|
||
sendEmail,
|
||
sendRemark,
|
||
// managerChange,
|
||
headers,
|
||
beforeUpload,
|
||
handleExport,
|
||
AccountStatusList,
|
||
searchSubmit,
|
||
searchReset,
|
||
columns,
|
||
tableData,
|
||
changePagination,
|
||
addTeacher,
|
||
cancelTeacherDialog,
|
||
handleLook,
|
||
cancel,
|
||
deleteModal,
|
||
handleModify,
|
||
closeDeleteTeacher,
|
||
createTeacherDialog,
|
||
handleOperate,
|
||
closehandleOperate,
|
||
getTableDate, //list接口数据调用
|
||
TeacherSystem,
|
||
cancelTeacherDialog1,
|
||
// getpromotionrecordstableData
|
||
}
|
||
},
|
||
};
|
||
</script>
|
||
<style lang="scss" scoped>
|
||
.ant-form-item {
|
||
margin-bottom: 12px;
|
||
}
|
||
::v-deep .ant-upload.ant-upload-select-picture-card {
|
||
border-radius: 50% !important;
|
||
width: 90px;
|
||
height: 90px;
|
||
}
|
||
.headers {
|
||
height: 56px;
|
||
border-bottom: 1px solid #e8e8e8;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
// background-color: red;
|
||
margin-bottom: 20px;
|
||
flex-shrink: 0;
|
||
|
||
.headerTitle {
|
||
font-size: 18px;
|
||
font-weight: 600;
|
||
color: #333333;
|
||
line-height: 25px;
|
||
margin-left: 14px;
|
||
}
|
||
}
|
||
//导出按钮icon
|
||
.daochu {
|
||
width: 16px;
|
||
height: 18px;
|
||
background-image: url("../../assets/images/coursewareManage/export1.png");
|
||
}
|
||
|
||
//弹窗内详情样式
|
||
.display1 {
|
||
display: inline-block;
|
||
width: 200px;
|
||
}
|
||
|
||
// .display0{
|
||
// display:inline-block ;
|
||
// width:200px ;
|
||
// text-align:center }
|
||
//弹窗内确认取消按钮布局
|
||
.del_btnbox {
|
||
display: flex;
|
||
margin: 30px auto;
|
||
justify-content: center;
|
||
|
||
.del_btn {
|
||
width: 100px;
|
||
height: 40px;
|
||
background: rgba(64, 158, 255, 0);
|
||
border-radius: 8px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
cursor: pointer;
|
||
|
||
.btnText {
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
line-height: 40px;
|
||
}
|
||
}
|
||
|
||
.btn1 {
|
||
border: 1px solid rgba(64, 158, 255, 1);
|
||
color: #4ea6ff;
|
||
margin-right: 14px;
|
||
}
|
||
|
||
.btn2 {
|
||
background-color: #4ea6ff;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
|
||
.ant-table-cell-fix-right {
|
||
width: 300px !important;
|
||
}
|
||
|
||
.ant-table-tbody>tr>td {
|
||
text-align: center;
|
||
}
|
||
|
||
.ExternalLecturer { width: 100%;
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
|
||
.filter {
|
||
margin-left: 38px;
|
||
margin-right: 38px;
|
||
margin-top: 30px;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
flex-wrap: wrap;
|
||
.select {
|
||
margin-right: 20px;
|
||
margin-bottom: 20px;
|
||
}
|
||
}}
|
||
|
||
.ant-modal {
|
||
.ant-modal-content {
|
||
width: 424px !important;
|
||
|
||
.ant-modal-body {
|
||
.delete {
|
||
width: 424px;
|
||
background: #ffffff;
|
||
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.21);
|
||
border-radius: 4px;
|
||
position: absolute;
|
||
left: 50%;
|
||
top: 10%;
|
||
transform: translate(-50%, -50%);
|
||
|
||
.del_header {
|
||
position: absolute;
|
||
width: calc(100%);
|
||
height: 40px;
|
||
background: linear-gradient(
|
||
rgba(78, 166, 255, 0.2) 0%,
|
||
rgba(78, 166, 255, 0) 100%
|
||
);
|
||
}
|
||
|
||
.del_main {
|
||
width: 100%;
|
||
position: relative;
|
||
|
||
.header {
|
||
display: flex;
|
||
align-items: center;
|
||
padding-top: 20px;
|
||
padding-left: 26px;
|
||
font-size: 16px;
|
||
|
||
.del-icons {
|
||
width: 16px;
|
||
height: 16px;
|
||
position: relative;
|
||
margin-right: 10px;
|
||
|
||
img {
|
||
width: 100%;
|
||
height: 100%;
|
||
position: absolute;
|
||
top: 0px;
|
||
left: 0px;
|
||
background-size: 100% 100%;
|
||
}
|
||
}
|
||
|
||
.close_exit {
|
||
position: absolute;
|
||
right: 42px;
|
||
cursor: pointer;
|
||
width: 20px;
|
||
height: 20px;
|
||
background-image: url(@/assets/images/coursewareManage/close.png);
|
||
background-size: 100% 100%;
|
||
}
|
||
}
|
||
|
||
.body {
|
||
width: 100%;
|
||
margin: 34px auto 56px auto;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
}
|
||
|
||
.del_btnbox {
|
||
display: flex;
|
||
margin: 30px auto;
|
||
justify-content: center;
|
||
|
||
.del_btn {
|
||
width: 100px;
|
||
height: 40px;
|
||
background: rgba(64, 158, 255, 0);
|
||
border-radius: 8px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 14px;
|
||
flex-shrink: 0;
|
||
cursor: pointer;
|
||
|
||
.btnText {
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
line-height: 40px;
|
||
}
|
||
}
|
||
|
||
.btn1 {
|
||
border: 1px solid rgba(64, 158, 255, 1);
|
||
color: #4ea6ff;
|
||
}
|
||
|
||
.btn2 {
|
||
background-color: #4ea6ff;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
.CreatePath {
|
||
.out {
|
||
z-index: 9999;
|
||
display: block;
|
||
position: absolute;
|
||
top: 90px;
|
||
width: 1080px !important;
|
||
height: 650px;
|
||
overflow: auto;
|
||
background-color: #fff;
|
||
|
||
box-shadow: 0 0 10px rgba(118, 136, 166, 0.21);
|
||
left: 50%;
|
||
top: 300px;
|
||
transform: translate(-50%, -50%);
|
||
|
||
.top {
|
||
width: 100%;
|
||
height: 68px;
|
||
|
||
background: linear-gradient(rgba(78, 166, 255, 0.2) 0%,
|
||
rgba(78, 166, 255, 0) 100%);
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.topimg {
|
||
width: 18px;
|
||
height: 18px;
|
||
margin-left: 27px;
|
||
margin-top: -2px;
|
||
}
|
||
|
||
.topc {
|
||
color: #000000;
|
||
font-size: 16px;
|
||
margin-left: 8px;
|
||
}
|
||
}
|
||
|
||
.mid {
|
||
width: 100%;
|
||
height: 100%;
|
||
background-color: #fff;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
|
||
.d {
|
||
// margin-top: 8px;
|
||
// color: #ff4e4e;
|
||
margin-left: -5px;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// 重置样式
|
||
.resetbtn {
|
||
width: 100px;
|
||
height: 40px;
|
||
border-radius: 8px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 14px;
|
||
flex-shrink: 0;
|
||
cursor: pointer;
|
||
.search {
|
||
width: 15px;
|
||
height: 16px;
|
||
margin-right: 5px;
|
||
background: url("../../assets/images/courseManage/add0.png") no-repeat;
|
||
background-size: 100% 100%;
|
||
}
|
||
}
|
||
|
||
//展开收起样式
|
||
.moreidbtn {
|
||
border: none;
|
||
color: #4ea6ff;
|
||
width: 80px
|
||
}
|
||
|
||
//小竖线
|
||
.line{
|
||
float:left; width: 3px; height: 17px; background: #4ea6ff;border-radius: 30%; margin-top: 3px;
|
||
margin-left: -8px;
|
||
}
|
||
//抽屉功能
|
||
.drawaer
|
||
/* 改变所有 a-tree-select 输入框的高度 */
|
||
.ant-tree-select .ant-select-selection {
|
||
height: 40px;
|
||
line-height: 40px;
|
||
/* 确保文字垂直居中 */
|
||
}
|
||
.draitem{
|
||
width: 100%;
|
||
height: 40px !important;
|
||
border-radius: 8px;
|
||
line-height: 40px;
|
||
}
|
||
.drabtn{
|
||
height:40px;
|
||
width:80px;
|
||
border-radius:8px;
|
||
margin-right:20px
|
||
}
|
||
::v-deep .ant-select:not(.ant-select-customize-input) .ant-select-selector{
|
||
border-radius:8px;
|
||
height:40px;
|
||
}
|
||
.ant-col-12{
|
||
height:90px;
|
||
}
|
||
.item_inp {
|
||
flex: 1;
|
||
text-align: center ;
|
||
.i_upload_img {
|
||
width: 84px;
|
||
height: 84px;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.i_upload {
|
||
width: 100px;
|
||
height: 100px;
|
||
border: 1px solid #4ea6ff;
|
||
border-radius:50%;
|
||
text-align: center;
|
||
align-items: center;
|
||
cursor: pointer;
|
||
|
||
.addimg {
|
||
position: relative;
|
||
|
||
.heng {
|
||
position: absolute;
|
||
top: 50px;
|
||
left: 25px;
|
||
width: 50px;
|
||
border: 1px solid #4ea6ff;
|
||
}
|
||
|
||
.shu {
|
||
position: absolute;
|
||
top: 25px;
|
||
left: 50px;
|
||
height: 50px;
|
||
border: 1px solid #4ea6ff;
|
||
}
|
||
}
|
||
}
|
||
|
||
.ant-upload.ant-upload-select-picture-card {
|
||
border: 0px !important;
|
||
border-radius: 50%!important;
|
||
}
|
||
}
|
||
.ant-upload.ant-upload-select-picture-card {
|
||
border: 0px !important;
|
||
border-radius: 50%!important;
|
||
}
|
||
|
||
::v-deep .ant-select-selection-overflow-item {
|
||
margin-top: -2px;
|
||
}
|
||
|
||
::v-deep .ant-select-multiple .ant-select-selection-item {
|
||
height: 34px
|
||
}
|
||
.tableBox {
|
||
padding-bottom: 20px;
|
||
margin: 20px 38px 30px;
|
||
::v-deep .ant-select-dropdown{
|
||
display: inline-block;
|
||
}
|
||
::v-deep .ant-select-selection-item{
|
||
margin-left: 3px;
|
||
}
|
||
::v-deep .ant-pagination-options-size-changer.ant-select{
|
||
width: 84px;
|
||
}
|
||
.pa {
|
||
width: 100%;
|
||
display: flex;
|
||
justify-content: right;
|
||
}
|
||
}
|
||
.item_inp .i_upload_img[data-v-e369ffe0] {
|
||
border-radius:50%
|
||
}
|
||
</style> |