|
@@ -338,7 +338,13 @@
|
|
|
</div>
|
|
|
<!-- 保存按钮 -->
|
|
|
<div style="text-align:center;margin: 20px auto;">
|
|
|
- <el-button size="medium" type="success" @click="handleSave">保存</el-button>
|
|
|
+ <el-button
|
|
|
+ size="medium"
|
|
|
+ type="success"
|
|
|
+ @click="handleSave"
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
@@ -391,10 +397,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getFeedbackByPlanId } from "@/api/training/spec/feedback";
|
|
|
-import { getAnswerByPlanIdAndQuestionId } from "@/api/training/spec/answer";
|
|
|
+import { getAnswer, addAnswer, updateAnswer, listAnswer } from "@/api/training/spec/answer";
|
|
|
import { allFileList, delCommonfile } from "@/api/common/commonfile";
|
|
|
-import { addFeedback, getFeedbackByParams, listInvitedSuccessor, updateFeedback } from "@/api/training/spec/feedback";
|
|
|
+import { 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";
|
|
@@ -407,11 +412,13 @@ export default {
|
|
|
components: { Treeselect, Editor },
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 导师标签
|
|
|
+ mentorTabs: [],
|
|
|
// 详情对话框表格数据
|
|
|
tableData: [],
|
|
|
// 反馈id
|
|
|
feedbackId: null,
|
|
|
- // 会议日期快选项
|
|
|
+ // 会议日期快捷选项
|
|
|
pickerOptions: {
|
|
|
shortcuts: [{
|
|
|
text: '今天',
|
|
@@ -638,23 +645,152 @@ export default {
|
|
|
this.initPage();
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 获取导师标签页 */
|
|
|
+ getMentorTabs() {
|
|
|
+ // // 获取本导师反馈id
|
|
|
+ // getFeedbackByParams({
|
|
|
+ // successorId: this.queryParams.successorId,
|
|
|
+ // feedbackYear: this.queryParams.feedbackYear,
|
|
|
+ // feedbackSeason: this.queryParams.feedbackSeason
|
|
|
+ // })
|
|
|
+ // .then(response => {
|
|
|
+ // let data = response.data;
|
|
|
+ // this.mentorTabs.push({ key: data.mentorStaffId, value: data.mentorStaffName });
|
|
|
+ // // 获取parent_id为本导师反馈id的反馈记录
|
|
|
+ // return listFeedback( { parentId: data.id } );
|
|
|
+ // })
|
|
|
+ // .then(response => {
|
|
|
+ // let data = response.rows;
|
|
|
+ // for (let i = 0; i < data.length; i++) {
|
|
|
+ // this.mentorTabs.push({ key: data[i].mentorStaffId, value: data[i].mentorStaffName });
|
|
|
+ // }
|
|
|
+ // console.log(this.mentorTabs);
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ /** 问卷判空 */
|
|
|
+ isEmpty() {
|
|
|
+ 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 isEmpty = false;
|
|
|
+ for (let i = 0; i < radioArray.length; i++) {
|
|
|
+ if (radioArray[i] == "") {
|
|
|
+ isEmpty = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return isEmpty;
|
|
|
+ },
|
|
|
+ /** 计算导师评分 */
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 受邀导师平均分 = 总分 / 人数
|
|
|
+ invitedMentorFeedbackScoreAvg = invitedMentorFeedbackScoreSum / invitedMentors;
|
|
|
+ // 季度平均分 = 本导师评分 * 60% + 受邀导师平均分 * 40%
|
|
|
+ overallScore = mentorFeedbackScore * 0.6 + invitedMentorFeedbackScoreAvg * 0.4;
|
|
|
+ // 更新季度平均分
|
|
|
+ updateFeedback({ id: feedbackId, overallScore: overallScore });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 保存反馈问题 */
|
|
|
+ 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 (true) {
|
|
|
- // 新增问卷内容
|
|
|
-
|
|
|
- let feedback = {};
|
|
|
- feedback.id = this.feedbackId;
|
|
|
- feedback.mentorFeedback = this.mentorFeedback;
|
|
|
- // 修改导师反馈内容
|
|
|
- updateFeedback(feedback).then(response => {
|
|
|
- this.msgSuccess("保存成功");
|
|
|
- });
|
|
|
- } else {
|
|
|
+ // 问卷判空
|
|
|
+ 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) {
|
|
@@ -680,18 +816,18 @@ export default {
|
|
|
let answerObj2 = {};
|
|
|
let answerObj3 = {};
|
|
|
// 获取问题和答案
|
|
|
- getAnswerByPlanIdAndQuestionId(feedback1).then(response => {
|
|
|
+ getAnswer(feedback1).then(response => {
|
|
|
let data = response.data;
|
|
|
if (data != null) {
|
|
|
answerObj1 = { id: 1, question: data.question, answer: data.answer};
|
|
|
}
|
|
|
- return getAnswerByPlanIdAndQuestionId(feedback2);
|
|
|
+ return getAnswer(feedback2);
|
|
|
}).then(response => {
|
|
|
let data = response.data;
|
|
|
if (data != null) {
|
|
|
answerObj2 = { id: 2, question: data.question, answer: data.answer};
|
|
|
}
|
|
|
- return getAnswerByPlanIdAndQuestionId(feedback3);
|
|
|
+ return getAnswer(feedback3);
|
|
|
}).then(response => {
|
|
|
let data = response.data;
|
|
|
if (data != null) {
|
|
@@ -802,6 +938,8 @@ export default {
|
|
|
// 搜索条件默认为当年、当季度
|
|
|
this.queryParams.feedbackYear = date.getFullYear().toString();
|
|
|
this.queryParams.feedbackSeason = ( ( date.getMonth() + 2 ) / 3 ).toString();
|
|
|
+ // 获取导师标签列表
|
|
|
+ this.getMentorTabs();
|
|
|
// 获取学员下拉列表
|
|
|
this.getSuccessorOptions();
|
|
|
// 获取导师下拉列表
|
|
@@ -883,6 +1021,26 @@ export default {
|
|
|
this.mentorFeedback = data.mentorFeedback;
|
|
|
// 初始化汇报附件
|
|
|
this.initFileList(data.id);
|
|
|
+ // 获取14个问题的答案
|
|
|
+ listAnswer( { feedbackId: this.feedbackId } ).then(response => {
|
|
|
+ let data = response.rows;
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ if (data[i].questionId == "4") { this.radio1 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "5") { this.radio2 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "6") { this.radio3 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "7") { this.radio4 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "8") { this.radio5 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "9") { this.radio6 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "10") { this.radio7 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "11") { this.radio8 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "12") { this.radio9 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "13") { this.radio10 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "14") { this.radio11 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "15") { this.radio12 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "16") { this.radio13 = data[i].answer; }
|
|
|
+ if (data[i].questionId == "17") { this.radio14 = data[i].answer; }
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
// 获取作为受邀导师的学员列表
|
|
|
return listInvitedSuccessor(null);
|