接口联调

This commit is contained in:
wangxuemei
2024-08-15 18:04:20 +08:00
parent 63baa9f5d2
commit 0985531a5b
5 changed files with 187 additions and 130 deletions

View File

@@ -6,12 +6,9 @@
<a-form layout="inline">
<a-form-item class="select">
<!-- v-model:value="searchParam.name" -->
<div style="width: 276px; height: 40px; border-radius: 8px" >
<ProjectManager v-model:value="searchParam.managerId"
v-model:name="searchParam.manager"
placeholder="请输入工号/讲师姓名进行检索"
@onChange="managerChange" mode="multiple"></ProjectManager>
</div>
<a-input v-model:value="searchParam.teacherNameOrMobel" style="width: 276px; height: 40px; border-radius: 8px"
placeholder="请输入工号/讲师姓名进行检索" allowClear showSearch>
</a-input>
</a-form-item >
<a-form-item class="select">
<a-select style="width: 230px" v-model:value="searchParam.status" placeholder="账号状态"
@@ -84,17 +81,19 @@
<a-row :gutter="16">
<a-col :span="24">
<div class="item_inp" style="background-color: #fff;">
<a-tooltip>
<template #title>修改头像</template>
<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" />
<div class="i_upload" v-else>
:headers="headers" :before-upload="beforeUpload" >
<img class="i_upload_img" v-if="formParam.photo" :src="formParam.photo" alt="avatar" />
<div class="i_upload" v-else>
<div class="addimg">
<div class="heng"></div>
<div class="shu"></div>
</div>
</div>
</a-upload>
</a-tooltip>
<div class="i_bottom">
<div class="tip" style="margin-bottom: 10px;">
<span style="color: #999999; margin-left: 8px">支持图片格式为jpg/jpeg/png 图片最大为500KB</span>
@@ -274,6 +273,7 @@ export default {
currentPage1: 1,
pageSize1: 10,
close:false,
log:true,
promotionrecordsLoading: false, //晋级记录遮罩层
tableLoading: false,
tagsshow: "1",
@@ -298,7 +298,7 @@ export default {
},
vf:true,
searchParam: {
name: null,//姓名
teacherNameOrMobel: null,//姓名
status: null,//状态
pageNo: "1",
pageSize: "10"
@@ -341,6 +341,7 @@ export default {
return false;
};
const AccountStatusList = ref([
{ value: '', label: "全部" },
{ value: 0, label: "启用" },
{ value: 1, label: "停用" },
])
@@ -422,7 +423,7 @@ export default {
state.searchParam = {
pageNo: 1,
pageSize: 10,
name: null,
teacherNameOrMobel: null,
status: null
};
getTableDate();
@@ -441,36 +442,15 @@ export default {
})
};
getTableDate()
// // List接口数据
// const getTableDate = ()=>{
// state.tableloading = true ;
// api
// // api 接口命名
// getTeacherList({
// ...state.searchParam
// })
// .then((res)=>{
// console.log(res.data.rows)
// // state.tableDataTotal = Number(res.data.data.total);
// // state.tableLoading = false;
// // const tableData = res.data.rows;
// // // initDataSublist("", data);
// // console.log(data);
// // tableData.value = data;
// // console.log("tableData", tableData);
// })
// }
// 获取项目列表信息
//let tableData = ref([]);
// // 翻页
const changePagination = (page) => {
state.searchParam.pageNo = page;
state.currentPage1 = page;
state.pageSize1 = pageSize;
state.searchParam.pageSize = pageSize;
getTableDate();
};
// 新增讲师
const addTeacher = () => {
cancel()
state.teacherdialog = true;
state.teacherdialogtitle = '新增讲师'
state.vf = true
@@ -488,6 +468,11 @@ export default {
//保存
const createTeacherDialog = () => {
console.log(state.formParam);
rule()
if( state.log = true){
state.teacherdialog = true;
}
else{
if (state.vf == false) {
updateOutTeacher(state.formParam).then(response => {
message.success("修改成功");
@@ -500,6 +485,7 @@ export default {
}).catch((err) => {
console.log(err);
});
}
}
state.teacherdialog = false;
getTableDate();
@@ -565,6 +551,7 @@ export default {
const cancel = () => {
state.formParam = {
teacherType:'1',
photo: 'https://p0.itc.cn/q_70/images01/20211013/f45d91616a364d6ea9c42a8db69734aa.png',
name: null,
mobile: null,
email: null,
@@ -580,6 +567,16 @@ export default {
name: [{ required: true, message: '讲师不能为空' }],
supplier:[{ required: true, message: '供应商不能为空' }],
}
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_-]+)+$/
@@ -600,29 +597,27 @@ export default {
.catch((err) => {
console.log("外部讲师详情", err);
});
// state.formParam={
// name:record.name,
// mobile:record.mobile,
// email:record.email,
// teacherIntrofuce:record.teacherIntrofuce,
// remark:record.remark,
// }
// if(record.id!=null ){
// state.formParam.id = record.id
// }
}
function managerChange(e, l, d, t, orgName) {
console.log(e, l);
state.searchParam.userNo = d;
state.searchParam.name = t;
// state.searchParam.trainorgName=orgName
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( '手机号格式不正确')
}
}
const sendEmail=()=>{
const reg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.\w{2,}$/;
if (!reg.test(state.formParam.email)) {
message.warning( '邮箱格式不正确')
}
}
// getpromotionrecordstableData()
//导出功能
const handleExport = () => {
const handleExport = () => {
window.open(
`${process.env.VUE_APP_BASE_API}/teacher/export?pageNo=${state.currentPage1
}&pageSize=${state.pageSize1}&name=${state.searchParam.name ? state.searchParam.name : ""}&status=${state.searchParam.status ? state.searchParam.status : ""}`
`${process.env.VUE_APP_BASE_API}/teacher/export?pageNo=${state.searchParam.currentPage
}&pageSize=${state.searchParam.pageSize}&teacherNameOrMobel=${state.searchParam.teacherNameOrMobel ? state.searchParam.teacherNameOrMobel : ""}&status=${state.searchParam.status ? state.searchParam.status : ""}`
);
// this.download('lesson_records/export', {
// ...state.searchParam
@@ -631,7 +626,10 @@ export default {
return {
...toRefs(state),
rules,
managerChange,
rule,
sendPhone,
sendEmail,
// managerChange,
headers,
beforeUpload,
handleExport,