Merge remote-tracking branch 'zcwy/zcwy-teacher-manage' into zcwy-teacher-manage

# Conflicts:
#	src/views/lecturer/InsideTeaching.vue
This commit is contained in:
zhangsir
2024-11-14 20:46:25 +08:00
7 changed files with 163 additions and 87 deletions

View File

@@ -38,6 +38,14 @@
<a-table :header-cell-style="{ 'text-align': 'center' }" style="border: 1px solid #f2f6fe" :columns="columns"
:data-source="tableData" :loading="tableLoading" @expand="expandTable" :pagination="false">
<template #bodyCell="{ record, column }">
<template v-if="column.key === 'teaching'">
<a-space style="display:flex ;justify-content: space-around; ">
<!-- <template #content>
<p>{{ record.orgName}}</p>
</template> -->
<span>{{ record.teaching }} 分钟</span>
</a-space>
</template>
<template v-if="column.key === 'operation'">
<a-space >
<a-button type="link" @click="() => handleLook(record, String(record.courseform))">查看</a-button>
@@ -100,7 +108,8 @@
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="讲师名称" name="name">
<a-input v-model:value.trim="formParam.name" class="draitem" :maxlength="20"
<a-input v-model:value="formParam.name" class="draitem" :maxlength="20" showCount
@blur="sendName"
placeholder="请输入讲师姓名" allowClear showSearch>
</a-input>
</a-form-item>
@@ -117,7 +126,7 @@
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="供应商" name="supplier">
<a-input v-model:value.trim="formParam.supplier" class="draitem" :maxlength="30"
<a-input v-model:value="formParam.supplier" class="draitem" :maxlength="30" showCount
placeholder="请输入供应商" allowClear showSearch>
</a-input>
</a-form-item>
@@ -130,13 +139,13 @@
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="授课时长" name="defaultTeachingTime">
<a-input v-model:value="formParam.defaultTeachingTime" style="width:80%; height: 40px; border-radius: 8px ; "
<a-form-item label="初始授课时长" name="teaching">
<a-input v-model:value="formParam.teaching" style="width:80%; height: 40px; border-radius: 8px ; "
placeholder="0" allowClear showSearch suffix="分钟" @blur="clearNonNumber">
</a-input>
<span style="margin-left: 5px ;" v-if="formParam.defaultTeachingTime !== null">{{ (formParam.defaultTeachingTime / 60
<span style="margin-left: 5px ;" v-if="formParam.teaching !== null">{{ (formParam.teaching / 60
).toFixed(2) }}小时</span>
<span style="margin-left: 5px ;" v-if="formParam.defaultTeachingTime === null">0.00小时</span>
<span style="margin-left: 5px ;" v-if="formParam.teaching === null">0.00小时</span>
</a-form-item>
</a-col>
</a-row>
@@ -159,11 +168,12 @@
<!-- 备注 -->
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="备注">
<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>
@@ -263,7 +273,7 @@ import { getTeacherList, getTeacherById, deleteInTeacher, updateTeacherState, i
import { fileUp } from "../../api/indexEval";
import {getCookieForName} from "@/api/method"
import SearchTeacher from "@/components/project/SearchTeacher";
import boe from '@/assets/boe.jpg'
import avatar from '@/assets/avatar.png'
export default {
name: "ExternalLecturer",
components: {
@@ -315,9 +325,9 @@ export default {
formParam: {
description:"",
teacherType:'2',
photo:'',
photo:avatar,
status:1,
defaultTeachingTime:'',
teaching:'',
},
vf:true,
searchParam: {
@@ -399,11 +409,19 @@ export default {
width: 200,
},
{
title: '授课时长 ',
dataIndex: 'defaultTeachingTime',
key: 'defaultTeachingTime',
elipsis: true, align: "center",
width: 200,
title: '初始授课时长 ',
dataIndex: 'teaching',
key: 'teaching',
elipsis: true, align: "center",
scopedSlots: { customRender: "teaching" },
width: 400,
// customRender: (value, record) => {
// return (
// <div>
// {value.record.orgName}
// </div>
// )
// }
},
{
title: '账号状态 ',
@@ -483,10 +501,11 @@ export default {
cancel()
state.teacherdialog = true;
state.teacherdialogtitle = '新增讲师'
state.formParam.photo =userInfo.value?.avatar
// state.formParam.photo =userInfo.value?.avatar
state.formParam.photo = avatar
state.vf = true
state.formParam.status = '1'
state.formParam.photo = state.formParam.photo === null ?boe : state.formParam.photo
// state.formParam.photo = state.formParam.photo === null ?boe : state.formParam.photo
}
//修改讲师信息弹窗
@@ -517,6 +536,7 @@ export default {
return message.error(rules[formItemNames[i]][0].log)
}
}
state.formParam.description = repl(state.formParam.description)
state.formParam = {...state.formParam}
if (state.vf == false) {
updateInTeacher(state.formParam).then(response => {
@@ -613,7 +633,7 @@ export default {
status:1,
teacherType:2,
photo:null,
defaultTeachingTime:null,
teaching:null,
name: null,
mobile: null,
email: null,
@@ -675,24 +695,48 @@ export default {
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=()=>{
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( '手机号格式不正确')
// }
if (!state.formParam.mobile) {
} else if (!reg.test(state.formParam.mobile)) {
message.warning( '手机号格式不正确')
state.formParam.mobile=''
// state.formParam.mobile = state.formParam.mobile.replace(/\D/g, '');
}
}
const sendEmail=()=>{
const reg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.\w{2,}$/;
// if (!reg.test(state.formParam.email)) {
// message.warning( '邮箱格式不正确')
// }
if (!reg.test(state.formParam.email)) {
message.warning( '邮箱格式不正确')
state.formParam.email=''
// state.formParam.email = state.formParam.email.replace( /[\u4e00-\u9fa5]/g, '');
}
}
const clearNonNumber = () => {
state.formParam.defaultTeachingTime = state.formParam.defaultTeachingTime.replace(/\D/g, '');
state.formParam.teaching = state.formParam.teaching.replace(/\D/g, '');
// state.formParam.teaching
}
const sendRemark=()=>{
state.formParam.remark = state.formParam.remark.replace(/\s/g, '');
}
const repl = (val) => {
if(val){
val = val?.replace(/\s*&nbsp;\s*/g, '')
val = val?.replace(/\s+/g, '')
return val
}
}
// getpromotionrecordstableData()
//导出功能
const handleExport = () => {
@@ -727,8 +771,11 @@ export default {
rules,
rule,
formRef,
repl,
sendName,
sendPhone,
sendEmail,
sendRemark,
// managerChange,
headers,
beforeUpload,