保存修改验证调整

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"
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-col :span="24">
@@ -268,6 +268,7 @@ export default {
UploadOutlined,//图标--导出
},
setup() {
const formRef = ref();
const router = useRouter();
const state = reactive({
currentPage1: 1,
@@ -467,28 +468,32 @@ export default {
}
//保存
const createTeacherDialog = () => {
console.log(state.formParam);
rule()
if( state.log = true){
state.teacherdialog = true;
}
else{
formRef.value
.validate()
.then(() => {
if (state.vf == false) {
updateOutTeacher(state.formParam).then(response => {
message.success("修改成功");
state.teacherdialog = false;
cancel()
getTableDate();
});
}
else {
insertTeacherOutSide(state.formParam)
.then((res) => {
message.success("保存成功");
state.teacherdialog = false;
cancel()
getTableDate();
}).catch((err) => {
console.log(err);
});
}
}
state.teacherdialog = false;
getTableDate();
})
.catch(() => {
console.log('error', error);
});
};
//删除弹窗
const deleteModal = (record) => {
@@ -537,6 +542,7 @@ export default {
//取消按钮 清空输入的数据
const cancelTeacherDialog = () => {
if (state.teacherdialog = true) {
formRef.value.resetFields();
state.teacherdialog = false
cancel()
}
@@ -627,6 +633,7 @@ export default {
...toRefs(state),
rules,
rule,
formRef,
sendPhone,
sendEmail,
// managerChange,

View File

@@ -17,7 +17,7 @@
</div>
</a-form-item>
<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>
</a-input>
</a-form-item>
@@ -269,6 +269,7 @@
<script lang="jsx">
import { reactive, toRefs, ref } from "vue";
import { useRouter } from "vue-router";
import { useStore } from "vuex";
import {
RightOutlined,
UpOutlined,
@@ -281,7 +282,7 @@ import ProjectManager from "@/components/project/ProjectManagerNew";
import ProjectManagerOutTeacher from "@/components/project/ProjectManagerOutTeacher";
import dayjs from "dayjs";
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 AddTeacher from "../../components/drawers/project/AddTeacher"
export default {
@@ -296,6 +297,7 @@ export default {
ProjectManagerOutTeacher,
},
setup() {
const store = useStore();
const router = useRouter();
const state = reactive({
vf: false,
@@ -472,11 +474,11 @@ export default {
ellipsis: true,
key: "keywords",
align: "center",
customRender: ({ record,text }) =>
`${getSysTypeMap(record.sysType1, record.sysTypeId)?getSysTypeMap(record.sysType1) : ""}
${getSysTypeMap(record.sysType2, record.sysTypeId)?'-'+getSysTypeMap(record.sysType2) : ""}
${getSysTypeMap(record.sysType3, record.sysTypeId)?'-'+getSysTypeMap(record.sysType3) : ""}
`
//customRender: ({ record,text }) =>
//`${getSysTypeMap(record.sysType1, record.sysTypeId)?getSysTypeMap//(record.sysType1) : ""}
//${getSysTypeMap(record.sysType2, record.sysTypeId)?'-'+getSysTypeMap//(record.sysType2) : ""}
//${getSysTypeMap(record.sysType3, record.sysTypeId)?'-'+getSysTypeMap//(record.sysType3) : ""}
// `
},
{
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 = () => {
getTableDate();
@@ -574,7 +582,7 @@ export default {
let objA = { ...state.searchParam };
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") : "",
getOuterTeacherCourseList(objA)
getTeacherCourseList(objA)
.then((res) => {
tableData.value = res.data.data.records
state.tableDataTotal = Number(res.data.data.total);
@@ -582,7 +590,7 @@ export default {
console.log("获取tableData", tableData);
})
};
getTableDate();
getTableDate()
// // 翻页
const changePagination = (page) => {
state.searchParam.pageNo = page;
@@ -780,6 +788,7 @@ export default {
// getStu
AddressLista,
TeacherSystem,
// getSysTypeMap
}
},
};

View File

@@ -102,15 +102,15 @@
<div class="tableBox ">
<div style="float: right;">
<a-pagination v-if="tableDataTotal > 10" :showSizeChanger="true" :showQuickJumper="false " :hideOnSinglePage="true"
:pageSize="searchParam.pageSize" :current="searchParam.pageNo" :total="tableDataTotal" class="pagination"
@change="changePagination" />
<a-pagination v-if="tableDataTotal > 10" :showSizeChanger="true" :showQuickJumper="false"
:hideOnSinglePage="true" :pageSize="searchParam.pageSize" :current="searchParam.pageNo" :total="tableDataTotal"
class="pagination" @change="changePagination" />
</div>
</div>
<!-- 弹窗组件 -->
<a-drawer v-model:visible="teacherdialog" placement="right" @closa="cancelTeacherDialog" :maskClosable="true"
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-col :span="24">
<span class="line"></span><span>基本信息</span>
@@ -147,7 +147,8 @@
v-model:name="formParam.name"
placeholder="请输入工号/讲师姓名进行检索"
@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"
show-search allow-clear tree-data-simple-mode class="draitem"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :tree-data="treeData" placeholder="请输入讲师名称" /> -->
@@ -177,7 +178,8 @@
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="讲师级别" name="tlevelId" ><div @click="handlesel">
<a-form-item label="讲师级别" name="tlevelId">
<div @click="handlesel">
<a-select class="draitem" v-model:value="formParam.tlevelId" placeholder="请选择讲师级别" allowClear
:disabled="getLevelList.length !== 0 ? false : true" :options="getLevelList">
</a-select>
@@ -188,8 +190,8 @@
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="初始授课时长" name="defaultteachingTime">
<a-input v-model:value="formParam.defaultteachingTime" style="width:80%; height: 40px; border-radius: 8px; " @blur="clearNonNumber"
placeholder="0" allowClear showSearch suffix="分钟">
<a-input v-model:value="formParam.defaultteachingTime" style="width:80%; height: 40px; border-radius: 8px; "
@blur="clearNonNumber" placeholder="0" allowClear showSearch suffix="分钟">
</a-input>
<span style="margin-left: 5px ;" v-if="formParam.defaultteachingTime != null">{{
(formParam.defaultteachingTime / 60).toFixed(2) }}小时</span>
@@ -494,14 +496,8 @@
</div>
<!-- 修改状态功能弹窗 -->
<div>
<a-modal
v-model:visible="editTeacher"
:footer="null"
:closable="closableQR"
wrapClassName="DelModal"
style="margin-top: 400px"
:zIndex="9999"
>
<a-modal v-model:visible="editTeacher" :footer="null" :closable="closableQR" wrapClassName="DelModal"
style="margin-top: 400px" :zIndex="9999">
<div class="delete">
<div class="del_header"></div>
<div class="del_main">
@@ -531,6 +527,7 @@
</template>
<script lang="jsx">
import { reactive, toRefs, ref, watch } from "vue";
import { useStore } from "vuex";
import {
RightOutlined,
UpOutlined,
@@ -561,6 +558,8 @@ export default {
FolderAddOutlined,//图标--新增
},
setup() {
const formRef = ref();
const store = useStore();
const router = useRouter();
const state = reactive({
Addtitle: '选择教师专长',
@@ -594,7 +593,7 @@ export default {
name: null,
certStatus: 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: {
currentPage: 1,
@@ -962,6 +961,7 @@ export default {
])
// 搜索
const searchSubmit = () => {
store.commit("setShouInclude", ['lecturerlist']);
getTableDate();
};
//重置
@@ -981,6 +981,7 @@ export default {
pageNo: 1,
pageSize: 10,
};
store.commit("setShouInclude", []);
getTableDate();
};
// List接口数据
@@ -994,7 +995,8 @@ export default {
objA.map((item) => {
if (item.organizationName !== null) {
item.neworganizationName = item.organizationName.split('/')
item.neworganizationName= item.neworganizationName[item.neworganizationName.length-1]}
item.neworganizationName = item.neworganizationName[item.neworganizationName.length - 1]
}
})
tableData.value = objA
state.tableDataTotal = Number(res.data.data.total);
@@ -1014,7 +1016,7 @@ export default {
cancel()
state.teacherdialog = true;
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.vf = true
}
@@ -1028,26 +1030,73 @@ export default {
}
//保存
const createTeacherDialog = () => {
rule()
if( state.log = true){
state.teacherdialog = true;
}
else
{ if (state.vf == false) {
formRef.value
.validate()
.then(() => {
if (state.vf == false) {
updateInTeacher(state.formParam).then(response => {
message.success("修改成功");
state.teacherdialog = false;
cancel()
getTableDate();
});
}
else {
insertTeacher(state.formParam)
.then((res) => {
message.success("保存成功");
state.teacherdialog = false;
cancel()
getTableDate();
}).catch((err) => {
console.log(err);
});
}
state.teacherdialog = false;
getTableDate();}
})
.catch(() => {
console.log('error', error);
});
// rule()
// if (state.log = true) {
// state.teacherdialog = true;
// }
// else {
// // formRef.value.validate(valid => {
// // if (valid) {
// // 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();
// // }
// // }
// // )
// 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) => {
@@ -1095,6 +1144,7 @@ export default {
//取消按钮 清空输入的数据
const cancelTeacherDialog = () => {
if (state.teacherdialog = true) {
formRef.value.resetFields();
state.teacherdialog = false
cancel()
}
@@ -1129,7 +1179,7 @@ export default {
newdepartId: [{ required: true, message: '组织不能为空' }],
tlevelId: [{ required: true, message: '讲师级别不能为空' }],
tsystemId: [{ required: true, message: '讲师体系不能为空' }],
defaultteachingTime: [{ required: true, message: '授课时长不能为空' }],
defaultteachingTime: [{ required: true, message: '' }],
certStatus: [{ required: true, message: '认证状态不能为空' }],
}
@@ -1137,26 +1187,33 @@ export default {
if (state.formParam.name == null) {
state.log = true
message.warning('讲师不能为空')
return
600000000000000000000000000000000
}
if (state.formParam.departId == null) {
state.log = true
message.warning('组织不能为空')
return
}
if (state.formParam.tlevelId == null) {
state.log = true
message.warning('讲师级别不能为空')
return
}
if (state.formParam.tsystemId == null) {
state.log = true
message.warning('讲师体系不能为空')
return
}
if (state.formParam.defaultteachingTime == null) {
state.log = true
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.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.photo = state.formParam.photo === null ? 'https://p0.itc.cn/q_70/images01/20211013/f45d91616a364d6ea9c42a8db69734aa.png' : state.formParam.photo
}
@@ -1224,6 +1281,7 @@ export default {
...toRefs(state),
rules,
rule,
formRef,
handlesel,
// customPreview,
clearNonNumber,
@@ -1272,6 +1330,10 @@ export default {
};
</script>
<style lang="scss" scoped>
::v-deep .ant-upload.ant-upload-select-picture-card {
border-radius: 50% !important;
}
.add_content {
width: 40px;
height: 40px;
@@ -1590,6 +1652,7 @@ export default {
.item_inp .i_upload[data-v-6b882d01] {
border-radius: 50% !important;
}
::v-deep .ant-modal-close {
display: none;
}

View File

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

View File

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