保存修改验证调整

This commit is contained in:
wangxuemei
2024-08-27 17:34:20 +08:00
parent 66aac5dc34
commit ed8b4769de
5 changed files with 272 additions and 178 deletions

View File

@@ -70,7 +70,7 @@
<!-- 弹窗组件 --> <!-- 弹窗组件 -->
<a-drawer v-model:visible="teacherdialog" placement="right" @closa="cancelTeacherDialog" :maskClosable="true" <a-drawer v-model:visible="teacherdialog" placement="right" @closa="cancelTeacherDialog" :maskClosable="true"
width="60%" :title="teacherdialogtitle"> width="60%" :title="teacherdialogtitle">
<a-form :model="formParam" :rules="rules" layout="vertical"> <a-form :model="formParam" :rules="rules" layout="vertical" ref="formRef">
<!-- 基本信息 --> <!-- 基本信息 -->
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
@@ -268,6 +268,7 @@ export default {
UploadOutlined,//图标--导出 UploadOutlined,//图标--导出
}, },
setup() { setup() {
const formRef = ref();
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
currentPage1: 1, currentPage1: 1,
@@ -467,28 +468,32 @@ export default {
} }
//保存 //保存
const createTeacherDialog = () => { const createTeacherDialog = () => {
console.log(state.formParam); formRef.value
rule() .validate()
if( state.log = true){ .then(() => {
state.teacherdialog = true; if (state.vf == false) {
}
else{
if (state.vf == false) {
updateOutTeacher(state.formParam).then(response => { updateOutTeacher(state.formParam).then(response => {
message.success("修改成功"); message.success("修改成功");
state.teacherdialog = false;
cancel()
getTableDate();
}); });
} }
else { else {
insertTeacherOutSide(state.formParam) insertTeacherOutSide(state.formParam)
.then((res) => { .then((res) => {
message.success("保存成功"); message.success("保存成功");
state.teacherdialog = false;
cancel()
getTableDate();
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
}); });
} }
} })
state.teacherdialog = false; .catch(() => {
getTableDate(); console.log('error', error);
});
}; };
//删除弹窗 //删除弹窗
const deleteModal = (record) => { const deleteModal = (record) => {
@@ -537,6 +542,7 @@ export default {
//取消按钮 清空输入的数据 //取消按钮 清空输入的数据
const cancelTeacherDialog = () => { const cancelTeacherDialog = () => {
if (state.teacherdialog = true) { if (state.teacherdialog = true) {
formRef.value.resetFields();
state.teacherdialog = false state.teacherdialog = false
cancel() cancel()
} }
@@ -627,6 +633,7 @@ export default {
...toRefs(state), ...toRefs(state),
rules, rules,
rule, rule,
formRef,
sendPhone, sendPhone,
sendEmail, sendEmail,
// managerChange, // managerChange,

View File

@@ -17,7 +17,7 @@
</div> </div>
</a-form-item> </a-form-item>
<a-form-item class="select"> <a-form-item class="select">
<a-input v-model:value="searchParam.name" style="width: 260px; height: 40px; border-radius: 8px" <a-input v-model:value="searchParam.name" style="width: 276px; height: 40px; border-radius: 8px"
placeholder="请输入课程名称进行搜索" allowClear showSearch> placeholder="请输入课程名称进行搜索" allowClear showSearch>
</a-input> </a-input>
</a-form-item> </a-form-item>
@@ -269,6 +269,7 @@
<script lang="jsx"> <script lang="jsx">
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useStore } from "vuex";
import { import {
RightOutlined, RightOutlined,
UpOutlined, UpOutlined,
@@ -281,7 +282,7 @@ import ProjectManager from "@/components/project/ProjectManagerNew";
import ProjectManagerOutTeacher from "@/components/project/ProjectManagerOutTeacher"; import ProjectManagerOutTeacher from "@/components/project/ProjectManagerOutTeacher";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { updateInTeacher, getTeacherExpertise } from "../../api/Lecturer"; import { updateInTeacher, getTeacherExpertise } from "../../api/Lecturer";
import { getOuterTeacherCourseList, getAddress, updateInTeacherCourse, deleteInTeacherCourse, insertInTeacherCourse,getOuterTeacherCourseDetail } from "../../api/Teaching"; import { getTeacherCourseList, getAddress, updateInTeacherCourse, deleteInTeacherCourse, insertInTeacherCourse,getOuterTeacherCourseDetail } from "../../api/Teaching";
// import {getProjSt} from "../../api/indexProjStu"; // import {getProjSt} from "../../api/indexProjStu";
// import AddTeacher from "../../components/drawers/project/AddTeacher" // import AddTeacher from "../../components/drawers/project/AddTeacher"
export default { export default {
@@ -296,6 +297,7 @@ export default {
ProjectManagerOutTeacher, ProjectManagerOutTeacher,
}, },
setup() { setup() {
const store = useStore();
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
vf: false, vf: false,
@@ -472,11 +474,11 @@ export default {
ellipsis: true, ellipsis: true,
key: "keywords", key: "keywords",
align: "center", align: "center",
customRender: ({ record,text }) => //customRender: ({ record,text }) =>
`${getSysTypeMap(record.sysType1, record.sysTypeId)?getSysTypeMap(record.sysType1) : ""} //`${getSysTypeMap(record.sysType1, record.sysTypeId)?getSysTypeMap//(record.sysType1) : ""}
${getSysTypeMap(record.sysType2, record.sysTypeId)?'-'+getSysTypeMap(record.sysType2) : ""} //${getSysTypeMap(record.sysType2, record.sysTypeId)?'-'+getSysTypeMap//(record.sysType2) : ""}
${getSysTypeMap(record.sysType3, record.sysTypeId)?'-'+getSysTypeMap(record.sysType3) : ""} //${getSysTypeMap(record.sysType3, record.sysTypeId)?'-'+getSysTypeMap//(record.sysType3) : ""}
` // `
}, },
{ {
title: '授课时长(H) ', title: '授课时长(H) ',
@@ -545,6 +547,12 @@ export default {
// }, // },
]) ])
const getSysTypeMap = (code) => {
if(code=="")return
// console.log(store.state.sysTypeMap,'map集合');
return store.state.sysTypeMap.get(code)
}
// getSysTypeMap()
// 搜索 // 搜索
const searchSubmit = () => { const searchSubmit = () => {
getTableDate(); getTableDate();
@@ -568,21 +576,21 @@ export default {
}; };
getTableDate(); getTableDate();
}; };
// List接口数据 // List接口数据
const getTableDate = (obj) => { const getTableDate = (obj) => {
state.tableLoading = true state.tableLoading = true
let objA = { ...state.searchParam }; let objA = { ...state.searchParam };
objA.startDate = state.searchParam.startDate !== null ? dayjs(new Date(state.searchParam.startDate).getTime()).format("YYYY-MM-DD") : "", objA.startDate = state.searchParam.startDate !== null ? dayjs(new Date(state.searchParam.startDate).getTime()).format("YYYY-MM-DD") : "",
objA.endDate = state.searchParam.endDate !== null ? dayjs(new Date(state.searchParam.endDate).getTime()).format("YYYY-MM-DD") : "", objA.endDate = state.searchParam.endDate !== null ? dayjs(new Date(state.searchParam.endDate).getTime()).format("YYYY-MM-DD") : "",
getOuterTeacherCourseList(objA) getTeacherCourseList(objA)
.then((res) => { .then((res) => {
tableData.value = res.data.data.records tableData.value = res.data.data.records
state.tableDataTotal = Number(res.data.data.total); state.tableDataTotal = Number(res.data.data.total);
state.tableLoading = false state.tableLoading = false
console.log("获取tableData", tableData); console.log("获取tableData", tableData);
}) })
}; };
getTableDate(); getTableDate()
// // 翻页 // // 翻页
const changePagination = (page) => { const changePagination = (page) => {
state.searchParam.pageNo = page; state.searchParam.pageNo = page;
@@ -780,6 +788,7 @@ export default {
// getStu // getStu
AddressLista, AddressLista,
TeacherSystem, TeacherSystem,
// getSysTypeMap
} }
}, },
}; };

View File

@@ -78,7 +78,7 @@
<template #content> <template #content>
<p>{{ record.organizationName }}</p> <p>{{ record.organizationName }}</p>
</template> </template>
<span>{{ record.neworganizationName }}</span> <span>{{ record.neworganizationName }}</span>
</a-popover> </a-popover>
</a-space> </a-space>
</template> </template>
@@ -102,15 +102,15 @@
<div class="tableBox "> <div class="tableBox ">
<div style="float: right;"> <div style="float: right;">
<a-pagination v-if="tableDataTotal > 10" :showSizeChanger="true" :showQuickJumper="false " :hideOnSinglePage="true" <a-pagination v-if="tableDataTotal > 10" :showSizeChanger="true" :showQuickJumper="false"
:pageSize="searchParam.pageSize" :current="searchParam.pageNo" :total="tableDataTotal" class="pagination" :hideOnSinglePage="true" :pageSize="searchParam.pageSize" :current="searchParam.pageNo" :total="tableDataTotal"
@change="changePagination" /> class="pagination" @change="changePagination" />
</div> </div>
</div> </div>
<!-- 弹窗组件 --> <!-- 弹窗组件 -->
<a-drawer v-model:visible="teacherdialog" placement="right" @closa="cancelTeacherDialog" :maskClosable="true" <a-drawer v-model:visible="teacherdialog" placement="right" @closa="cancelTeacherDialog" :maskClosable="true"
width="60%" :title="teacherdialogtitle"> width="60%" :title="teacherdialogtitle">
<a-form :model="formParam" :rules="rules" layout="vertical"> <a-form :model="formParam" :rules="rules" layout="vertical" ref="formRef">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<span class="line"></span><span>基本信息</span> <span class="line"></span><span>基本信息</span>
@@ -120,18 +120,18 @@
<a-col :span="24"> <a-col :span="24">
<div class="item_inp" style="background-color: #fff;"> <div class="item_inp" style="background-color: #fff;">
<a-tooltip> <a-tooltip>
<template #title>修改头像</template> <template #title>修改头像</template>
<a-upload name="avatar" list-type="picture-card" class="avatar-uploader" :show-upload-list="false" <a-upload name="avatar" list-type="picture-card" class="avatar-uploader" :show-upload-list="false"
:headers="headers" :before-upload="beforeUpload" > :headers="headers" :before-upload="beforeUpload">
<img class="i_upload_img" v-if="formParam.photo" :src="formParam.photo" alt="avatar" /> <img class="i_upload_img" v-if="formParam.photo" :src="formParam.photo" alt="avatar" />
<div class="i_upload" v-else> <div class="i_upload" v-else>
<div class="addimg"> <div class="addimg">
<div class="heng"></div> <div class="heng"></div>
<div class="shu"></div> <div class="shu"></div>
</div>
</div> </div>
</div> </a-upload>
</a-upload> </a-tooltip>
</a-tooltip>
<div class="i_bottom"> <div class="i_bottom">
<div class="tip" style="margin-bottom: 10px;"> <div class="tip" style="margin-bottom: 10px;">
<span style="color: #999999; margin-left: 8px">支持图片格式为jpg/jpeg/png 图片最大为500KB</span> <span style="color: #999999; margin-left: 8px">支持图片格式为jpg/jpeg/png 图片最大为500KB</span>
@@ -143,11 +143,12 @@
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="12"> <a-col :span="12">
<a-form-item label="讲师名称" name="name"> <a-form-item label="讲师名称" name="name">
<!-- <ProjectManager v-model:value="formParam.userNo" <!-- <ProjectManager v-model:value="formParam.userNo"
v-model:name="formParam.name" v-model:name="formParam.name"
placeholder="请输入工号/讲师姓名进行检索" placeholder="请输入工号/讲师姓名进行检索"
@onChange="managerChange" mode="multiple"></ProjectManager> --> @onChange="managerChange" mode="multiple"></ProjectManager> -->
<SearchTeacher v-model:value="formParam.name" v-model:lable="formParam.orgName" v-model:newlable="formParam.neworgName"></SearchTeacher> <SearchTeacher v-model:value="formParam.name" v-model:lable="formParam.orgName"
v-model:newlable="formParam.neworgName"></SearchTeacher>
<!-- <a-tree-select v-model:value="formParam.name" <!-- <a-tree-select v-model:value="formParam.name"
show-search allow-clear tree-data-simple-mode class="draitem" show-search allow-clear tree-data-simple-mode class="draitem"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :tree-data="treeData" placeholder="请输入讲师名称" /> --> :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :tree-data="treeData" placeholder="请输入讲师名称" /> -->
@@ -155,10 +156,10 @@
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="讲师组织" name="orgName"> <a-form-item label="讲师组织" name="orgName">
<a-popover > <a-popover>
<template #content> <template #content>
{{ formParam.orgName }} {{ formParam.orgName }}
{{formParam.neworgName }} {{ formParam.neworgName }}
</template> </template>
<a-input disabled v-model:value="formParam.neworgName" class="draitem" <a-input disabled v-model:value="formParam.neworgName" class="draitem"
@@ -177,19 +178,20 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="讲师级别" name="tlevelId" ><div @click="handlesel"> <a-form-item label="讲师级别" name="tlevelId">
<a-select class="draitem" v-model:value="formParam.tlevelId" placeholder="请选择讲师级别" allowClear <div @click="handlesel">
:disabled="getLevelList.length !== 0 ? false : true" :options="getLevelList" > <a-select class="draitem" v-model:value="formParam.tlevelId" placeholder="请选择讲师级别" allowClear
</a-select> :disabled="getLevelList.length !== 0 ? false : true" :options="getLevelList">
</div> </a-select>
</div>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="12"> <a-col :span="12">
<a-form-item label="初始授课时长" name="defaultteachingTime"> <a-form-item label="初始授课时长" name="defaultteachingTime">
<a-input v-model:value="formParam.defaultteachingTime" style="width:80%; height: 40px; border-radius: 8px; " @blur="clearNonNumber" <a-input v-model:value="formParam.defaultteachingTime" style="width:80%; height: 40px; border-radius: 8px; "
placeholder="0" allowClear showSearch suffix="分钟"> @blur="clearNonNumber" placeholder="0" allowClear showSearch suffix="分钟">
</a-input> </a-input>
<span style="margin-left: 5px ;" v-if="formParam.defaultteachingTime != null">{{ <span style="margin-left: 5px ;" v-if="formParam.defaultteachingTime != null">{{
(formParam.defaultteachingTime / 60).toFixed(2) }}小时</span> (formParam.defaultteachingTime / 60).toFixed(2) }}小时</span>
@@ -216,7 +218,7 @@
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="讲师介绍"> <a-form-item label="讲师介绍">
<Editor v-model:value="formParam.description "/> <Editor v-model:value="formParam.description" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -230,7 +232,7 @@
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="擅长课程"> <a-form-item label="擅长课程">
<Editor v-model:value="formParam.courses "/> <Editor v-model:value="formParam.courses" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -467,7 +469,7 @@
<!-- 删除功能弹窗 --> <!-- 删除功能弹窗 -->
<div> <div>
<a-modal v-model:visible="deleteInTeacherdialog" :footer="null" :closable="closableQR" centered="true"> <a-modal v-model:visible="deleteInTeacherdialog" :footer="null" :closable="closableQR" centered="true">
<div class="delete"> <div class="delete">
<div class="del_header"></div> <div class="del_header"></div>
<div class="del_main"> <div class="del_main">
@@ -493,15 +495,9 @@
</a-modal> </a-modal>
</div> </div>
<!-- 修改状态功能弹窗 --> <!-- 修改状态功能弹窗 -->
<div> <div>
<a-modal <a-modal v-model:visible="editTeacher" :footer="null" :closable="closableQR" wrapClassName="DelModal"
v-model:visible="editTeacher" style="margin-top: 400px" :zIndex="9999">
:footer="null"
:closable="closableQR"
wrapClassName="DelModal"
style="margin-top: 400px"
:zIndex="9999"
>
<div class="delete"> <div class="delete">
<div class="del_header"></div> <div class="del_header"></div>
<div class="del_main"> <div class="del_main">
@@ -531,6 +527,7 @@
</template> </template>
<script lang="jsx"> <script lang="jsx">
import { reactive, toRefs, ref, watch } from "vue"; import { reactive, toRefs, ref, watch } from "vue";
import { useStore } from "vuex";
import { import {
RightOutlined, RightOutlined,
UpOutlined, UpOutlined,
@@ -561,12 +558,14 @@ export default {
FolderAddOutlined,//图标--新增 FolderAddOutlined,//图标--新增
}, },
setup() { setup() {
const formRef = ref();
const store = useStore();
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
Addtitle: '选择教师专长', Addtitle: '选择教师专长',
log:false, log: false,
showContent: false, showContent: false,
closableQR:false, closableQR: false,
updialog: false, updialog: false,
moreid: 1, moreid: 1,
byPid: null, byPid: null,
@@ -590,15 +589,15 @@ export default {
tableDataTotal: -1,//table列表总条数 tableDataTotal: -1,//table列表总条数
vf: false, vf: false,
formParam: { formParam: {
teachenType:'0', teachenType: '0',
name: null, name: null,
certStatus: 0,//认证状态 certStatus: 0,//认证状态
defaultteachingTime: '0', defaultteachingTime: '0',
photo: 'https://p0.itc.cn/q_70/images01/20211013/f45d91616a364d6ea9c42a8db69734aa.png' // photo: 'https://p0.itc.cn/q_70/images01/20211013/f45d91616a364d6ea9c42a8db69734aa.png'
}, },
searchParam: { searchParam: {
currentPage: 1, currentPage: 1,
pageSize1: 10, pageSize1: 10,
teacherNameOrUserNo: null, teacherNameOrUserNo: null,
systemId: null, systemId: null,
tlevelId: null, tlevelId: null,
@@ -638,7 +637,7 @@ export default {
watch(() => state.formParam.courses, (val) => { watch(() => state.formParam.courses, (val) => {
console.log(val, 'courses') console.log(val, 'courses')
}) })
watch(()=>state.formParam.orgName,(val)=>{ watch(() => state.formParam.orgName, (val) => {
console.log(val, 'orgName') console.log(val, 'orgName')
// if( val !==null ){ // if( val !==null ){
// state.formParam.neworgName=val.split('/') // state.formParam.neworgName=val.split('/')
@@ -962,6 +961,7 @@ export default {
]) ])
// 搜索 // 搜索
const searchSubmit = () => { const searchSubmit = () => {
store.commit("setShouInclude", ['lecturerlist']);
getTableDate(); getTableDate();
}; };
//重置 //重置
@@ -981,6 +981,7 @@ export default {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
}; };
store.commit("setShouInclude", []);
getTableDate(); getTableDate();
}; };
// List接口数据 // List接口数据
@@ -990,13 +991,14 @@ export default {
getTeacherList(objA) getTeacherList(objA)
.then((res) => { .then((res) => {
// tableData.value = res.data.data.records // tableData.value = res.data.data.records
let objA= res.data.data.records let objA = res.data.data.records
objA.map((item)=>{ objA.map((item) => {
if( item.organizationName !==null ){ if (item.organizationName !== null) {
item.neworganizationName=item.organizationName.split('/') item.neworganizationName = item.organizationName.split('/')
item.neworganizationName= item.neworganizationName[item.neworganizationName.length-1]} item.neworganizationName = item.neworganizationName[item.neworganizationName.length - 1]
}) }
tableData.value = objA })
tableData.value = objA
state.tableDataTotal = Number(res.data.data.total); state.tableDataTotal = Number(res.data.data.total);
state.tableLoading = false state.tableLoading = false
}) })
@@ -1014,7 +1016,7 @@ export default {
cancel() cancel()
state.teacherdialog = true; state.teacherdialog = true;
state.teacherdialogtitle = '新增讲师' state.teacherdialogtitle = '新增讲师'
state.formParam.photo = state.formParam.photo === null ? 'https://p0.itc.cn/q_70/images01/20211013/f45d91616a364d6ea9c42a8db69734aa.png' : state.formParam.photo // state.formParam.photo = state.formParam.photo === null ? 'https://p0.itc.cn/q_70/images01/20211013/f45d91616a364d6ea9c42a8db69734aa.png' : state.formParam.photo
state.formParam.status = '1' state.formParam.status = '1'
state.vf = true state.vf = true
} }
@@ -1028,26 +1030,73 @@ export default {
} }
//保存 //保存
const createTeacherDialog = () => { const createTeacherDialog = () => {
rule() formRef.value
if( state.log = true){ .validate()
state.teacherdialog = true; .then(() => {
} if (state.vf == false) {
else updateInTeacher(state.formParam).then(response => {
{ if (state.vf == false) { message.success("修改成功");
updateInTeacher(state.formParam).then(response => { state.teacherdialog = false;
message.success("修改成功"); cancel()
getTableDate();
});
}
else {
insertTeacher(state.formParam)
.then((res) => {
message.success("保存成功");
state.teacherdialog = false;
cancel()
getTableDate();
}).catch((err) => {
console.log(err);
});
}
})
.catch(() => {
console.log('error', error);
}); });
} // rule()
else { // if (state.log = true) {
insertTeacher(state.formParam) // state.teacherdialog = true;
.then((res) => { // }
message.success("保存成功"); // else {
}).catch((err) => { // // formRef.value.validate(valid => {
console.log(err); // // if (valid) {
}); // // if (state.vf == false) {
} // // updateInTeacher(state.formParam).then(response => {
state.teacherdialog = false; // // message.success("修改成功");
getTableDate();} // // });
// // }
// // else {
// // insertTeacher(state.formParam)
// // .then((res) => {
// // message.success("保存成功");
// // }).catch((err) => {
// // console.log(err);
// // });
// // }
// // state.teacherdialog = false;
// // getTableDate();
// // }
// // }
// // )
// if (state.vf == false) {
// updateInTeacher(state.formParam).then(response => {
// message.success("修改成功");
// });
// }
// else {
// insertTeacher(state.formParam)
// .then((res) => {
// message.success("保存成功");
// }).catch((err) => {
// console.log(err);
// });
// }
// state.teacherdialog = false;
// getTableDate();
// }
}; };
//删除弹窗 //删除弹窗
const deleteModal = (record) => { const deleteModal = (record) => {
@@ -1095,6 +1144,7 @@ export default {
//取消按钮 清空输入的数据 //取消按钮 清空输入的数据
const cancelTeacherDialog = () => { const cancelTeacherDialog = () => {
if (state.teacherdialog = true) { if (state.teacherdialog = true) {
formRef.value.resetFields();
state.teacherdialog = false state.teacherdialog = false
cancel() cancel()
} }
@@ -1106,9 +1156,9 @@ export default {
//清空数据 //清空数据
const cancel = () => { const cancel = () => {
state.formParam = { state.formParam = {
name:null, name: null,
status:null, status: null,
teacherType:'0', teacherType: '0',
photo: null, photo: null,
teacherNameOrUserNo: null, teacherNameOrUserNo: null,
newdepartId: null, newdepartId: null,
@@ -1129,34 +1179,41 @@ export default {
newdepartId: [{ required: true, message: '组织不能为空' }], newdepartId: [{ required: true, message: '组织不能为空' }],
tlevelId: [{ required: true, message: '讲师级别不能为空' }], tlevelId: [{ required: true, message: '讲师级别不能为空' }],
tsystemId: [{ required: true, message: '讲师体系不能为空' }], tsystemId: [{ required: true, message: '讲师体系不能为空' }],
defaultteachingTime: [{ required: true, message: '授课时长不能为空' }], defaultteachingTime: [{ required: true, message: '' }],
certStatus: [{ required: true, message: '认证状态不能为空' }], certStatus: [{ required: true, message: '认证状态不能为空' }],
} }
const rule =()=>{ const rule = () => {
if (state.formParam.name==null){ if (state.formParam.name == null) {
state.log = true state.log = true
message.warning( '讲师不能为空') message.warning('讲师不能为空')
return
600000000000000000000000000000000
} }
if (state.formParam.departId==null){ if (state.formParam.departId == null) {
state.log = true state.log = true
message.warning( '组织不能为空') message.warning('组织不能为空')
return
} }
if (state.formParam.tlevelId==null){ if (state.formParam.tlevelId == null) {
state.log = true state.log = true
message.warning( '讲师级别不能为空') message.warning('讲师级别不能为空')
return
} }
if (state.formParam.tsystemId==null){ if (state.formParam.tsystemId == null) {
state.log = true state.log = true
message.warning( '讲师体系不能为空') message.warning('讲师体系不能为空')
return
} }
if (state.formParam.defaultteachingTime==null){ if (state.formParam.defaultteachingTime == null) {
state.log = true
message.warning( '授课时长不能为空')
}
if (state.formParam.certStatus==null){
state.log = true state.log = true
message.warning( '认证状态不能为空') message.warning('授课时长不能为空')
return
}
if (state.formParam.certStatus == null) {
state.log = true
message.warning('认证状态不能为空')
return
} }
} }
// //表格内查看数据操作 // //表格内查看数据操作
@@ -1177,7 +1234,7 @@ export default {
// } // }
state.formParam = res.data.data[0] state.formParam = res.data.data[0]
state.formParam.description = state.formParam.description === null ? '' : state.formParam.description state.formParam.description = state.formParam.description === null ? '' : state.formParam.description
state.formParam.workExperience = state.formParam.workExperience === null ? '' : state.formParam.workExperience state.formParam.workExp0erience = state.formParam.workExperience === null ? '' : state.formParam.workExperience
state.formParam.courses = state.formParam.courses === null ? '' : state.formParam.courses state.formParam.courses = state.formParam.courses === null ? '' : state.formParam.courses
state.formParam.photo = state.formParam.photo === null ? 'https://p0.itc.cn/q_70/images01/20211013/f45d91616a364d6ea9c42a8db69734aa.png' : state.formParam.photo state.formParam.photo = state.formParam.photo === null ? 'https://p0.itc.cn/q_70/images01/20211013/f45d91616a364d6ea9c42a8db69734aa.png' : state.formParam.photo
} }
@@ -1198,15 +1255,15 @@ export default {
// const customPreview =(e)=>{ // const customPreview =(e)=>{
// e.stopPropagation() // e.stopPropagation()
// } // }
const handlesel=()=>{ const handlesel = () => {
console.log( '请下选择讲师体系') console.log('请下选择讲师体系')
if (state.formParam.tsystemId == undefimed) { if (state.formParam.tsystemId == undefimed) {
message.warning( '请下选择讲师体系') message.warning('请下选择讲师体系')
} }
} }
//导出功能 //导出功能
const handleExport = () => { const handleExport = () => {
window.open ( window.open(
`${process.env.VUE_APP_BASE_API}/teacher/export?pageNo=${state.searchParam.currentPage `${process.env.VUE_APP_BASE_API}/teacher/export?pageNo=${state.searchParam.currentPage
}&pageSize=${state.searchParam.pageSize} }&pageSize=${state.searchParam.pageSize}
&teacherNameOrUserNo=${state.searchParam.teacherNameOrUserNo ? state.searchParam.teacherNameOrUserNo : ""} &teacherNameOrUserNo=${state.searchParam.teacherNameOrUserNo ? state.searchParam.teacherNameOrUserNo : ""}
@@ -1224,6 +1281,7 @@ export default {
...toRefs(state), ...toRefs(state),
rules, rules,
rule, rule,
formRef,
handlesel, handlesel,
// customPreview, // customPreview,
clearNonNumber, clearNonNumber,
@@ -1272,6 +1330,10 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .ant-upload.ant-upload-select-picture-card {
border-radius: 50% !important;
}
.add_content { .add_content {
width: 40px; width: 40px;
height: 40px; height: 40px;
@@ -1590,7 +1652,8 @@ export default {
.item_inp .i_upload[data-v-6b882d01] { .item_inp .i_upload[data-v-6b882d01] {
border-radius: 50% !important; border-radius: 50% !important;
} }
::v-deep .ant-modal-close{
::v-deep .ant-modal-close {
display: none; display: none;
} }
</style> </style>

View File

@@ -19,10 +19,24 @@
placeholder="请输入课程名称进行搜索" allowClear showSearch> placeholder="请输入课程名称进行搜索" allowClear showSearch>
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item class="select "> <!-- <a-form-item class="select ">
<a-range-picker style="width: 260px; height: 40px; border-radius: 8px" v-model:value="searchdate" separator="至" <a-range-picker style="width: 260px; height: 40px; border-radius: 8px" v-model:value="searchdate" separator="至"
:placeholder="[' 开始时间', ' 结束时间']" @change="searchTimeChange" /> :placeholder="[' 开始时间', ' 结束时间']" @change="searchTimeChange" />
</a-form-item> </a-form-item> -->
<a-form-item class="select ">
<div class="select addTimeBox">
<div class="addTime" >创建时间</div>
<a-range-picker
v-model:value="searchdate"
style="width: 420px"
@change="searchTimeChange"
format="YYYY-MM-DD"
valueFormat="YYYY-MM-DD"
separator="至"
:placeholder="[' 开始时间', ' 结束时间']"
/>
</div>
</a-form-item>
<div style="display: flex; margin-bottom: 20px"> <div style="display: flex; margin-bottom: 20px">
<a-button @click="searchSubmit()" type="primary" class="resetbtn">查询 </a-button> <a-button @click="searchSubmit()" type="primary" class="resetbtn">查询 </a-button>
<!-- <div class="btn btn1" @click="searchReset" style="background:rgba(64, 158, 255, 0);" > --> <!-- <div class="btn btn1" @click="searchReset" style="background:rgba(64, 158, 255, 0);" > -->
@@ -87,16 +101,11 @@
<a-button @click="addTeacher()" type="primary" class="langbtn"> <a-button @click="addTeacher()" type="primary" class="langbtn">
<FolderAddOutlined /> 添加授课记录 <FolderAddOutlined /> 添加授课记录
</a-button> </a-button>
<!-- <div style="margin-left: 20px ;"> <!-- <a-upload multiple :headers="headers" :show-upload-list="false" :before-upload="beforeUpload2"> -->
<a-button @click="addTeacher()" class="langbtn"> <a-button class="resetbtn" @click="handleImport()" >
<UploadOutlined /> 一键生成讲师费
</a-button>
</div> -->
<a-upload multiple :headers="headers" :show-upload-list="false" :before-upload="beforeUpload2">
<a-button class="resetbtn">
<DownloadOutlined /> 导入 <DownloadOutlined /> 导入
</a-button> </a-button>
</a-upload> <!-- </a-upload> -->
<a-button @click="handleExport()" class="resetbtn"> <a-button @click="handleExport()" class="resetbtn">
<UploadOutlined /> 导出 <UploadOutlined /> 导出
</a-button> </a-button>
@@ -129,7 +138,7 @@
<!-- 弹窗组件 --> <!-- 弹窗组件 -->
<a-drawer v-model:visible="teacherdialog" placement="right" @closa="cancelTeacherDialog" :maskClosable="true" <a-drawer v-model:visible="teacherdialog" placement="right" @closa="cancelTeacherDialog" :maskClosable="true"
dropdown-style="drawaer" width="60%" :title="teacherdialogtitle"> dropdown-style="drawaer" width="60%" :title="teacherdialogtitle">
<a-form :model="formParam" :rules="rules" layout="vertical"> <a-form :model="formParam" :rules="rules" layout="vertical" ref="formRef">
<!-- 讲师姓名 teacher 组织 departId--> <!-- 讲师姓名 teacher 组织 departId-->
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="12"> <a-col :span="12">
@@ -380,6 +389,7 @@ export default {
FolderAddOutlined,//图标--新增 FolderAddOutlined,//图标--新增
}, },
setup() { setup() {
const formRef = ref();
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
moreid: 1, moreid: 1,
@@ -641,7 +651,7 @@ export default {
} }
}, },
{ {
title: '授课/课程日期 ', title: '授课时间',
dataIndex: 'beginTime', dataIndex: 'beginTime',
key: 'beginTime', key: 'beginTime',
elipsis: true, align: "center", elipsis: true, align: "center",
@@ -739,7 +749,7 @@ export default {
state.searchParam.trainorgId = null state.searchParam.trainorgId = null
state.searchParam.systemId = null state.searchParam.systemId = null
state.searchParam.id = null state.searchParam.id = null
state.searchParam.scoreranges = null state.searchParam.scoreranges = []
state.searchParam.studysranges = [] state.searchParam.studysranges = []
} }
} }
@@ -747,17 +757,14 @@ export default {
const searchSubmit = () => { const searchSubmit = () => {
getTableDate(); getTableDate();
}; };
//修改时间 //修改时间
const searchTimeChange = (e, date) => { function searchTimeChange(time, timeStr) {
let startDate = date[0] + " 00:00:00"; state.searchParam.startDate = timeStr[0];
let endDate = date[1] + " 23:59:59"; state.searchParam.endDate = timeStr[1];
state.startDate = new Date(startDate).getTime(); console.log( state.searchParam.startDate)
state.endDate = new Date(endDate).getTime(); console.log(state.searchParam.endDate)
// state.searchParam.startDate = new Date(startDate).getTime() ; }
// state.searchParam.endDate = new Date(endDate).getTime() ;
state.searchParam.startDate = state.startDate ? state.startDate : null,
state.searchParam.endDate = state.endDate ? state.endDate : null
};
const editTimeChange = (e, date) => { const editTimeChange = (e, date) => {
console.log(date); console.log(date);
state.beginTime = date; state.beginTime = date;
@@ -823,28 +830,32 @@ export default {
} }
//保存 //保存
const createTeacherDialog = () => { const createTeacherDialog = () => {
rule() formRef.value
if (state.log = true) { .validate()
state.teacherdialog = true; .then(() => {
if (state.vf == false) {
updateInTeacherCourse(state.formParam).then(response => {
message.success("修改成功");
state.teacherdialog = false;
cancel()
getTableDate();
});
} }
else { else {
if (state.vf == false) { insertInTeacherCourse(state.formParam)
updateInTeacherCourse(state.formParam).then(response => { .then((res) => {
message.success("修改成功"); message.success("保存成功");
state.teacherdialog = false;
cancel()
getTableDate();
}).catch((err) => {
console.log(err);
}); });
} }
else { })
insertInTeacherCourse(state.formParam) .catch(() => {
.then((res) => { console.log('error', error);
message.success("保存成功"); })
}).catch((err) => {
console.log(err);
});
cancel()
}
getTableDate();
state.teacherdialog = false
}
} }
//删除弹窗 //删除弹窗
const deleteModal = (record) => { const deleteModal = (record) => {
@@ -872,6 +883,7 @@ export default {
//取消按钮 清空输入的数据 //取消按钮 清空输入的数据
const cancelTeacherDialog = () => { const cancelTeacherDialog = () => {
if (state.teacherdialog = true) { if (state.teacherdialog = true) {
formRef.value.resetFields();
state.teacherdialog = false state.teacherdialog = false
cancel() cancel()
} }
@@ -1135,6 +1147,7 @@ export default {
beforeUpload2, beforeUpload2,
rules, rules,
rule, rule,
formRef,
column, column,
tableDatas, tableDatas,
gettableDatas, gettableDatas,
@@ -1192,7 +1205,9 @@ export default {
color: rgba(0, 0, 0, 0.4); color: rgba(0, 0, 0, 0.4);
} }
} }
.addTimeBox .ant-picker{
padding-left: 85px;
}
//导出按钮icon //导出按钮icon
.daochu { .daochu {
width: 16px; width: 16px;

View File

@@ -17,9 +17,9 @@
</div> </div>
</a-form-item> </a-form-item>
<a-form-item class="select"> <a-form-item class="select">
<a-select style="width: 276px" v-model:value="searchParam.trainorgId" placeholder="培训发生组织" allowClear <a-input v-model:value="searchParam.trainorgId" style="width: 276px; height: 40px; border-radius: 8px"
:options="trainOrglist"> placeholder="请输入培训发生组织进行搜索" allowClear showSearch>
</a-select> </a-input>
</a-form-item> </a-form-item>
<a-form-item class="select "> <a-form-item class="select ">
<a-range-picker style="width: 260px; height: 40px; border-radius: 8px" v-model:value="searchdate" separator="至" <a-range-picker style="width: 260px; height: 40px; border-radius: 8px" v-model:value="searchdate" separator="至"