mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 10:56:46 +08:00
feat:增加证书学员分页获取
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: lixg lixg@dongwu-inc.com
|
||||
* @Date: 2022-11-04 22:45:31
|
||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||
* @LastEditTime: 2023-02-04 19:59:55
|
||||
* @LastEditTime: 2023-02-06 15:11:40
|
||||
* @FilePath: /fe-manage/src/api/index1.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
@@ -208,4 +208,5 @@ export const getStageList = (obj) => http.get('/admin/project/getStageList', { p
|
||||
export const getTaskList = (obj) => http.get('/admin/project/getTaskList', { params: obj })
|
||||
//查看证书学员列表
|
||||
export const stuCertList = (obj) => http.get('/admin/certificate/stuCertList', { params: obj })
|
||||
|
||||
//更新学员证书
|
||||
export const updateStuCert = (obj) => http.post('/admin/certificate/updateStuCert', obj)
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
>
|
||||
<div class="drawerMain">
|
||||
<div class="header">
|
||||
<div class="headerTitle">{{ edit ? "编辑" : "添加" }}证书</div>
|
||||
<div class="headerTitle">
|
||||
{{ ACertificateEditId ? "编辑" : "添加" }}证书
|
||||
</div>
|
||||
<img
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../../assets/images/basicinfo/close.png"
|
||||
@@ -432,6 +434,7 @@ export default {
|
||||
state.CCertificate = false;
|
||||
state.stageList = [];
|
||||
state.taskList = [];
|
||||
state.examList = [];
|
||||
state.selectStageName = null;
|
||||
state.selectStageId = null;
|
||||
state.selectTaskName = null;
|
||||
@@ -454,6 +457,7 @@ export default {
|
||||
if (bool) {
|
||||
getStageList();
|
||||
getTaskList();
|
||||
getTaskExam();
|
||||
}
|
||||
};
|
||||
//获取阶段
|
||||
@@ -474,16 +478,22 @@ export default {
|
||||
});
|
||||
};
|
||||
//获取任务
|
||||
const getTaskList = () => {
|
||||
const getTaskList = (exam) => {
|
||||
let obj = {
|
||||
projectId: props.projectId,
|
||||
type: exam ? 5 : 0,
|
||||
};
|
||||
|
||||
api
|
||||
.getTaskList(obj)
|
||||
.then((res) => {
|
||||
console.log("获取任务列表", res);
|
||||
if (res.data.code === 200) {
|
||||
state.taskList = res.data.data;
|
||||
if (exam) {
|
||||
state.examList = res.data.data;
|
||||
} else {
|
||||
state.taskList = res.data.data;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -491,7 +501,9 @@ export default {
|
||||
});
|
||||
};
|
||||
//获取考试
|
||||
|
||||
const getTaskExam = () => {
|
||||
getTaskList(true);
|
||||
};
|
||||
//选择阶段
|
||||
const selectStage = (e, k) => {
|
||||
console.log("选择阶段", e, k);
|
||||
@@ -520,7 +532,7 @@ export default {
|
||||
state.selectTaskName = null;
|
||||
state.selectTaskId = null;
|
||||
state.selectExamName = e;
|
||||
state.selectExamId = e.examId;
|
||||
state.selectExamId = k.projectTaskId;
|
||||
};
|
||||
//选择的获得条件
|
||||
const selectCondition = (e) => {
|
||||
@@ -573,8 +585,48 @@ export default {
|
||||
.certificatedetail(obj)
|
||||
.then((res) => {
|
||||
console.log("获取证书详情", res);
|
||||
// if (res.data.code === 200) {
|
||||
// }
|
||||
if (res.data.code === 200) {
|
||||
let info = res.data.data;
|
||||
state.certificateName = info.name; //证书名称
|
||||
state.imageUrl = process.env.VUE_APP_FILE_PATH + info.url; //证书封面
|
||||
state.certificateRemark = info.remark; //证书说明
|
||||
state.condition = info.finishType; //选择条件
|
||||
state.large = info.finishType == 1 ? info.finishValue : null; //选择项目里的全部任务或必修任务
|
||||
state.selectStageId =
|
||||
info.finishType == 2 ? info.finishValue : null;
|
||||
state.selectTaskId = info.finishType == 3 ? info.finishValue : null;
|
||||
state.selectExamId = info.finishType == 4 ? info.finishValue : null;
|
||||
state.score = info.finishType == 5 ? info.finishValue : null; //积分
|
||||
|
||||
let timer = setInterval(() => {
|
||||
if (
|
||||
state.stageList.length !== 0 &&
|
||||
state.taskList.length !== 0 &&
|
||||
state.examList.length !== 0
|
||||
) {
|
||||
if (info.finishType == 2) {
|
||||
let stageItem = state.stageList.filter((item) => {
|
||||
return item.stageId == info.finishValue;
|
||||
});
|
||||
state.selectStageName = stageItem ? stageItem[0].name : null;
|
||||
}
|
||||
if (info.finishType == 3) {
|
||||
let taskItem = state.taskList.filter((item) => {
|
||||
return item.projectTaskId == info.finishValue;
|
||||
});
|
||||
state.selectTaskName = taskItem ? taskItem[0].name : null;
|
||||
}
|
||||
if (info.finishType == 4) {
|
||||
let taskItem = state.examList.filter((item) => {
|
||||
return item.projectTaskId == info.finishValue;
|
||||
});
|
||||
console.log("taskItem", taskItem);
|
||||
state.selectExamName = taskItem ? taskItem[0].name : null;
|
||||
}
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("获取证书详情失败", err);
|
||||
@@ -583,7 +635,7 @@ export default {
|
||||
//添加证书
|
||||
const saveupdatecertificate = () => {
|
||||
if (!state.certificateName) return message.warning("请输入证书名称");
|
||||
if (!state.imageName) return message.warning("请上传证书封面");
|
||||
if (!state.imageUrl) return message.warning("请上传证书封面");
|
||||
if (!state.condition) return message.warning("请设置获得条件");
|
||||
if (state.condition == 1 && !state.large)
|
||||
return message.warning("请选择完成项目类型");
|
||||
@@ -595,45 +647,46 @@ export default {
|
||||
return message.warning("请选择考试");
|
||||
if (state.condition == 5 && !state.score)
|
||||
return message.warning("请输入积分");
|
||||
|
||||
let obj = {
|
||||
pid: props.projectId,
|
||||
name: state.certificateName,
|
||||
url: state.imageName,
|
||||
remark: state.certificateRemark,
|
||||
finishType: state.condition,
|
||||
finishValue:
|
||||
state.condition == 1
|
||||
? state.large
|
||||
: state.condition == 2
|
||||
? state.selectStageId
|
||||
: state.condition == 3
|
||||
? state.selectTaskId
|
||||
: state.condition == 4
|
||||
? state.selectExamId
|
||||
: state.condition == 5
|
||||
? state.score
|
||||
: "",
|
||||
type: 1,
|
||||
};
|
||||
if (props.ACertificateEdit) {
|
||||
console.log("更新证书");
|
||||
} else {
|
||||
console.log("新增证书");
|
||||
|
||||
let obj = {
|
||||
pid: props.projectId,
|
||||
name: state.certificateName,
|
||||
url: state.imageName,
|
||||
finishType: state.condition,
|
||||
finishValue:
|
||||
state.condition == 1
|
||||
? state.large
|
||||
: state.condition == 2
|
||||
? state.selectStageId
|
||||
: state.condition == 3
|
||||
? state.selectTaskId
|
||||
: state.condition == 4
|
||||
? state.selectExamId
|
||||
: state.condition == 5
|
||||
? state.score
|
||||
: "",
|
||||
type: 1,
|
||||
};
|
||||
reset();
|
||||
api
|
||||
.saveupdatecertificate(obj)
|
||||
.then((res) => {
|
||||
console.log("新增证书", res);
|
||||
if (res.data.code === 200) {
|
||||
message.success("证书添加成功");
|
||||
props.getCertificate && props.getCertificate();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("新增证书失败", err);
|
||||
});
|
||||
obj.id = props.ACertificateEditId;
|
||||
}
|
||||
|
||||
reset();
|
||||
api
|
||||
.saveupdatecertificate(obj)
|
||||
.then((res) => {
|
||||
console.log("新增/编辑成功证书", res);
|
||||
if (res.data.code === 200) {
|
||||
message.success(
|
||||
props.ACertificateEdit ? "证书修改成功" : "证书添加成功"
|
||||
);
|
||||
props.getCertificate && props.getCertificate();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("新增/编辑证书失败", err);
|
||||
});
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div class="TableCertificateStudent">
|
||||
<div class="certificatetitle">
|
||||
<span style="margin-left: 32px">培训证书</span>
|
||||
<button class="returnBtn" @click="returnClick">返回</button>
|
||||
</div>
|
||||
<div class="search">
|
||||
<div class="selectBox">
|
||||
@@ -25,11 +26,10 @@
|
||||
<div>选择时间:</div>
|
||||
<div class="select in">
|
||||
<a-range-picker
|
||||
style="width: 320px; height: 40px; border-radius: 8px"
|
||||
:disabled-date="disabledDate"
|
||||
:disabled-time="disabledRangeTime"
|
||||
format="YYYY/MM/DD HH:mm"
|
||||
v-model:value="chooseTime"
|
||||
v-model:value="selectTime"
|
||||
style="width: 320px"
|
||||
format="YYYY-MM-DD"
|
||||
separator="至"
|
||||
:placeholder="[' 开始时间', ' 结束时间']"
|
||||
/>
|
||||
</div>
|
||||
@@ -92,6 +92,7 @@
|
||||
import { reactive, toRefs } from "vue";
|
||||
import * as api from "@/api/index1";
|
||||
import OrgClass from "@/components/project/OrgClass";
|
||||
import { message } from "ant-design-vue";
|
||||
export default {
|
||||
name: "TableCertificateStudent",
|
||||
components: {
|
||||
@@ -107,12 +108,17 @@ export default {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
ischeckCertificate: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
studentName: null,
|
||||
tstudentDepartId: null,
|
||||
studentDepartName: null,
|
||||
selectTime: null,
|
||||
tablecolumns: [
|
||||
{
|
||||
title: "工号",
|
||||
@@ -195,19 +201,28 @@ export default {
|
||||
],
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
tableDataTotal: 1,
|
||||
tableDataTotal: -1,
|
||||
selectedRowKeys: [],
|
||||
});
|
||||
|
||||
//获取证书学员
|
||||
const stuCertList = () => {
|
||||
let obj = {
|
||||
name: state.studentName,
|
||||
orgName: state.studentDepartName,
|
||||
id: props.ACertificateCheckId,
|
||||
pid: props.projectId,
|
||||
size: state.pageSize,
|
||||
};
|
||||
state.tableDataTotal = -1;
|
||||
api
|
||||
.stuCertList(obj)
|
||||
.then((res) => {
|
||||
console.log("获取证书学员", res);
|
||||
if (res.data.code === 200) {
|
||||
state.stuList = res.data.data.record;
|
||||
state.tableDataTotal = res.data.data.total;
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("获取证书学员失败", err);
|
||||
@@ -215,18 +230,63 @@ export default {
|
||||
};
|
||||
stuCertList();
|
||||
|
||||
//搜索
|
||||
const search = () => {
|
||||
state.currentPage = 1;
|
||||
stuCertList();
|
||||
};
|
||||
//重置
|
||||
const reset = () => {
|
||||
state.currentPage = 1;
|
||||
state.studentName = null;
|
||||
state.tstudentDepartId = null;
|
||||
state.studentDepartName = null;
|
||||
state.selectTime = null;
|
||||
};
|
||||
|
||||
//取消授权
|
||||
const updateStuCert = (text) => {
|
||||
console.log("text", text);
|
||||
let obj = {
|
||||
id: text.record.id,
|
||||
status: -1,
|
||||
};
|
||||
api
|
||||
.updateStuCert(obj)
|
||||
.then((res) => {
|
||||
console.log("取消证书成功", res);
|
||||
if (res.data.code === 200) {
|
||||
message.success("取消证书成功");
|
||||
stuCertList();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("取消证书失败", err);
|
||||
});
|
||||
};
|
||||
const onSelectChange = (selectedRowKeys, e) => {
|
||||
console.log("selectedRowKeys changed: ", selectedRowKeys, e);
|
||||
state.selectedRowKeys = selectedRowKeys;
|
||||
};
|
||||
//分页
|
||||
const changePaginationStu = (page) => {
|
||||
state.currentPage = page;
|
||||
stuCertList();
|
||||
};
|
||||
|
||||
//返回
|
||||
const returnClick = () => {
|
||||
ctx.emit("update:ischeckCertificate", false);
|
||||
console.log("点击返回");
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
stuCertList,
|
||||
search,
|
||||
reset,
|
||||
onSelectChange,
|
||||
changePaginationStu,
|
||||
returnClick,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -240,12 +300,26 @@ export default {
|
||||
.certificatetitle {
|
||||
width: 100%;
|
||||
height: 74px;
|
||||
padding-top: 40px;
|
||||
padding-top: 29px;
|
||||
border-bottom: 1px solid rgba(232, 232, 232, 1);
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: 25px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.returnBtn {
|
||||
cursor: pointer;
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
background: #4ea6ff;
|
||||
border-radius: 8px;
|
||||
border: 0;
|
||||
margin-left: 15px;
|
||||
color: #fff;
|
||||
margin-right: 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.search {
|
||||
display: flex;
|
||||
|
||||
@@ -1091,6 +1091,7 @@
|
||||
:projectId="projectId"
|
||||
:ACertificateCheckId="ACertificateCheckId"
|
||||
v-if="ischeckCertificate"
|
||||
v-model:ischeckCertificate="ischeckCertificate"
|
||||
>
|
||||
</TableCertificateStudent>
|
||||
</a-tab-pane>
|
||||
@@ -3592,6 +3593,10 @@ export default {
|
||||
rankReset();
|
||||
state.tabFlag = false;
|
||||
}
|
||||
|
||||
if(e!=7){
|
||||
state.ischeckCertificate=false
|
||||
}
|
||||
console.log("切换了", state.tabFlag);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user