|
@@ -422,7 +422,7 @@
|
|
|
import { getAnswer, addAnswer, updateAnswer, listAnswer } from "@/api/training/spec/answer";
|
|
|
import { listScore, getScore, delScore, addScore, updateScore, exportScore, importTemplate} from "@/api/training/spec/score";
|
|
|
import { allFileList, delCommonfile } from "@/api/common/commonfile";
|
|
|
-import { addFeedback, getFeedbackByParams, listInvitedSuccessor, updateFeedback, listFeedback, getFeedbackByPlanId } from "@/api/training/spec/feedback";
|
|
|
+import { saveSeasonalFeedback, addFeedback, getFeedbackByParams, listInvitedSuccessor, updateFeedback, listFeedback, getFeedbackByPlanId } from "@/api/training/spec/feedback";
|
|
|
import { listMentors } from "@/api/training/spec/successor";
|
|
|
import { listSuccessorsByMentorId, listPlanSeasonal } from "@/api/training/spec/plan";
|
|
|
import { getToken } from "@/utils/auth";
|
|
@@ -682,6 +682,41 @@ export default {
|
|
|
this.initPageData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 保存按钮处理 */
|
|
|
+ handleSave() {
|
|
|
+ // 问卷判空
|
|
|
+ if (this.isEmpty()) {
|
|
|
+ this.$message.error('问卷答案不能为空')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 保存季度反馈
|
|
|
+ saveSeasonalFeedback({
|
|
|
+ // 反馈id
|
|
|
+ feedbackId: this.feedbackId,
|
|
|
+ // 导师反馈内容
|
|
|
+ mentorFeedback: this.mentorFeedback,
|
|
|
+ // 问卷内容
|
|
|
+ tStQuestionAnswerArray:
|
|
|
+ [
|
|
|
+ { questionId: 4, answer:this.radio1 },
|
|
|
+ { questionId: 5, answer:this.radio2 },
|
|
|
+ { questionId: 6, answer:this.radio3 },
|
|
|
+ { questionId: 7, answer:this.radio4 },
|
|
|
+ { questionId: 8, answer:this.radio5 },
|
|
|
+ { questionId: 9, answer:this.radio6 },
|
|
|
+ { questionId: 10, answer:this.radio7 },
|
|
|
+ { questionId: 11, answer:this.radio8 },
|
|
|
+ { questionId: 12, answer:this.radio9 },
|
|
|
+ { questionId: 13, answer:this.radio10 },
|
|
|
+ { questionId: 14, answer:this.radio11 },
|
|
|
+ { questionId: 15, answer:this.radio12 },
|
|
|
+ { questionId: 16, answer:this.radio13 },
|
|
|
+ { questionId: 17, answer:this.radio14 },
|
|
|
+ ]
|
|
|
+ }).then(() => {
|
|
|
+ this.msgSuccess("保存成功");
|
|
|
+ });
|
|
|
+ },
|
|
|
/** 设置最后截止日期 */
|
|
|
resetLastDay() {
|
|
|
// 最后截止日期
|
|
@@ -918,194 +953,6 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
- /** 计算导师评分 */
|
|
|
- calcFeedbackScore() {
|
|
|
- let mentorFeedbackScore = 0; // 本导师评分
|
|
|
- let invitedMentorFeedbackScoreSum = 0; // 受邀导师总分
|
|
|
- let invitedMentorFeedbackScoreAvg = 0; // 受邀导师平均分
|
|
|
- let invitedMentors = 0; // 受邀导师人数
|
|
|
- let overallScore = 0; // 季度平均分
|
|
|
- let feedbackId = null; // 本导师反馈id
|
|
|
- // 获取问题答案列表
|
|
|
- listAnswer( { feedbackId: this.feedbackId } )
|
|
|
- .then(response => {
|
|
|
- let data = response.rows;
|
|
|
- // 计算导师评分
|
|
|
- let total = 0; // 总分
|
|
|
- for (let i = 0; i < data.length; i++) {
|
|
|
- if(data[i].answer == "1") {
|
|
|
- total += 100;
|
|
|
- }
|
|
|
- else if(data[i].answer == "2") {
|
|
|
- total += 75;
|
|
|
- }
|
|
|
- else if(data[i].answer == "3") {
|
|
|
- total += 50;
|
|
|
- }
|
|
|
- else if(data[i].answer == "4") {
|
|
|
- total += 25;
|
|
|
- }
|
|
|
- }
|
|
|
- let avg = total / 14; // 平均分
|
|
|
- // 更新当前导师评分
|
|
|
- return updateFeedback( { id: this.feedbackId, feedbackScore: avg } );
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- // 获取本导师反馈
|
|
|
- return getFeedbackByParams({
|
|
|
- successorId: this.queryParams.successorId,
|
|
|
- feedbackYear: this.queryParams.feedbackYear,
|
|
|
- feedbackSeason: this.queryParams.feedbackSeason
|
|
|
- })
|
|
|
- })
|
|
|
- .then(response => {
|
|
|
- // 设置本导师反馈id
|
|
|
- feedbackId = response.data.id;
|
|
|
- // 设置导师评分
|
|
|
- mentorFeedbackScore = response.data.feedbackScore;
|
|
|
- // 获取受邀导师列表
|
|
|
- return listFeedback( { parentId: feedbackId } );
|
|
|
- })
|
|
|
- .then(response => {
|
|
|
- let data = response.rows;
|
|
|
- for (let i = 0; i < data.length; i++) {
|
|
|
- if (data[i].feedbackScore != null) {
|
|
|
- invitedMentorFeedbackScoreSum += Number(data[i].feedbackScore);
|
|
|
- invitedMentors += 1;
|
|
|
- }
|
|
|
- }
|
|
|
- // 计算受邀导师平均分
|
|
|
- if (invitedMentorFeedbackScoreSum == 0) { // 受邀导师未评分
|
|
|
- invitedMentorFeedbackScoreAvg = 0;
|
|
|
- } else {
|
|
|
- // 受邀导师平均分 = 总分 / 人数
|
|
|
- invitedMentorFeedbackScoreAvg = invitedMentorFeedbackScoreSum / invitedMentors;
|
|
|
- }
|
|
|
- // 计算季度平均分
|
|
|
- if (invitedMentorFeedbackScoreSum == 0) { // 受邀导师未评分
|
|
|
- overallScore = mentorFeedbackScore;
|
|
|
- } else if (mentorFeedbackScore == 0) { // 本导师未评分
|
|
|
- overallScore = invitedMentorFeedbackScoreAvg;
|
|
|
- } else {
|
|
|
- // 季度平均分 = 本导师评分 * 60% + 受邀导师平均分 * 40%
|
|
|
- overallScore = mentorFeedbackScore * 0.6 + invitedMentorFeedbackScoreAvg * 0.4;
|
|
|
- }
|
|
|
- // 更新季度平均分
|
|
|
- updateFeedback({ id: feedbackId, overallScore: overallScore });
|
|
|
- // 更新继任者评分表数据
|
|
|
- getScore({
|
|
|
- successorId: this.queryParams.successorId,
|
|
|
- feedbackYear: this.queryParams.feedbackYear,
|
|
|
- feedbackSeason: this.queryParams.feedbackSeason
|
|
|
- })
|
|
|
- .then(response => {
|
|
|
- let data = response.data;
|
|
|
- let score = {};
|
|
|
- if (this.queryParams.feedbackSeason == "1") {
|
|
|
- score.quarterOne = overallScore;
|
|
|
- }
|
|
|
- if (this.queryParams.feedbackSeason == "2") {
|
|
|
- score.quarterTwo = overallScore;
|
|
|
- }
|
|
|
- if (this.queryParams.feedbackSeason == "3") {
|
|
|
- score.quarterThree = overallScore;
|
|
|
- }
|
|
|
- if (this.queryParams.feedbackSeason == "4") {
|
|
|
- score.quarterFour = overallScore;
|
|
|
- }
|
|
|
- if (data != null) { // 更新季度评分
|
|
|
- score.id = data.id;
|
|
|
- updateScore(score);
|
|
|
- } else { // 新增评分
|
|
|
- score.staffId = this.queryParams.successorId;
|
|
|
- score.feedbackYear = this.queryParams.feedbackYear;
|
|
|
- score.feedbackSeason = this.queryParams.feedbackSeason;
|
|
|
- addScore(score);
|
|
|
- }
|
|
|
- // return getScore({
|
|
|
- // successorId: this.queryParams.successorId,
|
|
|
- // feedbackYear: this.queryParams.feedbackYear,
|
|
|
- // feedbackSeason: this.queryParams.feedbackSeason
|
|
|
- // });
|
|
|
- })
|
|
|
- // .then(response => { // 计算年度评分
|
|
|
- // let data = response.data;
|
|
|
- // let count = 0;
|
|
|
- // let sum = 0;
|
|
|
- // if (data.quarterOne != null) {
|
|
|
- // count++;
|
|
|
- // sum += data.quarterOne;
|
|
|
- // }
|
|
|
- // if (data.quarterTwo != null) {
|
|
|
- // count++;
|
|
|
- // sum += data.quarterTwo;
|
|
|
- // }
|
|
|
- // if (data.quarterThree != null) {
|
|
|
- // count++;
|
|
|
- // sum += data.quarterThree;
|
|
|
- // }
|
|
|
- // if (data.quarterFour != null) {
|
|
|
- // count++;
|
|
|
- // sum += data.quarterFour;
|
|
|
- // }
|
|
|
- // let year = sum / count;
|
|
|
- // let score = {};
|
|
|
- // score.id = data.id;
|
|
|
- // score.year = year;
|
|
|
- // updateScore(score);
|
|
|
- // });
|
|
|
- });
|
|
|
- },
|
|
|
- /** 保存反馈问题 */
|
|
|
- saveAnswer(questionId, answer) {
|
|
|
- let answerObj = {};
|
|
|
- answerObj.feedbackId = this.feedbackId;
|
|
|
- answerObj.questionId = questionId;
|
|
|
- getAnswer(answerObj).then(response => {
|
|
|
- let data = response.data;
|
|
|
- answerObj.answer = answer;
|
|
|
- if (data != null) {
|
|
|
- if (response.answer == data.answer) { // 答案一致
|
|
|
- return;
|
|
|
- } else { // 答案不一致
|
|
|
- answerObj.id = data.id;
|
|
|
- updateAnswer(answerObj).then(response => {
|
|
|
- // 计算导师评分
|
|
|
- this.calcFeedbackScore();
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- addAnswer(answerObj).then(response => {
|
|
|
- // 计算导师评分
|
|
|
- this.calcFeedbackScore();
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- /** 保存导师反馈内容 */
|
|
|
- saveMentorFeedback() {
|
|
|
- let feedback = {};
|
|
|
- feedback.id = this.feedbackId;
|
|
|
- feedback.mentorFeedback = this.mentorFeedback;
|
|
|
- updateFeedback(feedback);
|
|
|
- },
|
|
|
- /** 保存按钮处理 */
|
|
|
- handleSave() {
|
|
|
- // 问卷判空
|
|
|
- if (this.isEmpty()) {
|
|
|
- this.$message.error('问卷答案不能为空')
|
|
|
- return;
|
|
|
- }
|
|
|
- let radioArray = [ this.radio1, this.radio2, this.radio3, this.radio4, this.radio5, this.radio6, this.radio7, this.radio8, this.radio9, this.radio10, this.radio11, this.radio12, this.radio13, this.radio14 ];
|
|
|
- let questionArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
|
|
|
- // 保存问卷内容
|
|
|
- for (let i = 0; i < radioArray.length; i++) {
|
|
|
- this.saveAnswer(questionArray[i]+3, radioArray[i]);
|
|
|
- }
|
|
|
- // 保存导师反馈内容
|
|
|
- this.saveMentorFeedback();
|
|
|
- this.msgSuccess("保存成功");
|
|
|
- },
|
|
|
/** 培养计划详情处理 */
|
|
|
handleFeedback(row) {
|
|
|
// 加载反馈附件
|