|
@@ -267,7 +267,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 清空、批量删除 -->
|
|
|
- <div class="exam-question-edit-row a-card-margin-top">
|
|
|
+ <!-- <div class="exam-question-edit-row a-card-margin-top">
|
|
|
<a-button
|
|
|
type="primary"
|
|
|
:disabled="!currentHasSelected"
|
|
@@ -286,7 +286,7 @@
|
|
|
@click="deleteCurrentTableSelectDataFun"
|
|
|
>批量删除</a-button
|
|
|
>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<!-- 表单 -->
|
|
|
<a-table
|
|
|
:columns="current_columns"
|
|
@@ -350,13 +350,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { EXAM_TYPE, EXAM_QUESTION_TYPE } from '@/common/Constant'; // EXAM_QUESTION_TYPE
|
|
|
+import { EXAM_TYPE, EXAM_QUESTION_TYPE } from '@/common/Constant';
|
|
|
import {
|
|
|
formateSeconds,
|
|
|
formateUrlParams,
|
|
|
formatePathParams,
|
|
|
formateDateTimeToAfter,
|
|
|
formatTimeHoursMinuteSecondsFun,
|
|
|
+ formateEngineeringWork,
|
|
|
} from '@/filters';
|
|
|
import { mapGetters } from 'vuex';
|
|
|
const ExamTimeLong = {
|
|
@@ -491,7 +492,7 @@ export default {
|
|
|
let totalGrades = 0;
|
|
|
that.current_tableData.forEach((item) => {
|
|
|
if (item.points) {
|
|
|
- totalGrades = totalGrades + item.points;
|
|
|
+ totalGrades = totalGrades + Number(item.points);
|
|
|
}
|
|
|
});
|
|
|
return totalGrades;
|
|
@@ -595,12 +596,12 @@ export default {
|
|
|
// 考试时长
|
|
|
let tarTime = formatTimeHoursMinuteSecondsFun(resData.duration);
|
|
|
// 工种
|
|
|
- if (
|
|
|
- resData.engineerTypes &&
|
|
|
- resData.engineerTypes[0] &&
|
|
|
- resData.engineerTypes[0].id
|
|
|
- ) {
|
|
|
- resData.engineeringWork = resData.engineerTypes[0].id;
|
|
|
+ if (resData.engineerTypes) {
|
|
|
+ let findItem = formateEngineeringWork(
|
|
|
+ this.engineeringWorkList,
|
|
|
+ resData.engineerTypes[0]
|
|
|
+ );
|
|
|
+ resData.engineerTypeTxt = findItem.name;
|
|
|
} else {
|
|
|
resData.engineerTypeTxt = '不限';
|
|
|
}
|
|
@@ -611,10 +612,8 @@ export default {
|
|
|
examLongTimeHours: tarTime.hours || '', // 考试时长:小时
|
|
|
examLongTimeMinutes: tarTime.minutes || '', // 考试时长:分钟
|
|
|
description: resData.description || '', // 考试描述
|
|
|
- examCategory:
|
|
|
- resData.examCategory || this.engineeringWorkList[0].id, // 考试类型
|
|
|
- engineeringWork:
|
|
|
- resData.engineeringWork || this.examTypeList[0].code, // 工种类别
|
|
|
+ examCategory: resData.examCategory || this.examTypeList[0].code, // 考试类型
|
|
|
+ engineeringWork: resData.engineerTypeTxt, // 工种类别
|
|
|
};
|
|
|
console.log('基础数据', this.examDetailData);
|
|
|
this.loading = false;
|
|
@@ -655,12 +654,14 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
// 工种
|
|
|
- if (
|
|
|
- item.engineerTypes &&
|
|
|
- item.engineerTypes[0] &&
|
|
|
- item.engineerTypes[0].id
|
|
|
- ) {
|
|
|
- item.engineerTypesTxt = item.engineerTypes[0].name;
|
|
|
+ if (item.engineerTypes) {
|
|
|
+ let findItem = formateEngineeringWork(
|
|
|
+ this.engineeringWorkList,
|
|
|
+ item.engineerTypes[0]
|
|
|
+ );
|
|
|
+ item.engineerTypeTxt = findItem.name;
|
|
|
+ } else {
|
|
|
+ item.engineerTypeTxt = '不限';
|
|
|
}
|
|
|
});
|
|
|
this.current_tableData = resData;
|
|
@@ -842,9 +843,6 @@ export default {
|
|
|
e.preventDefault();
|
|
|
this.loginForm.validateFields((err, values) => {
|
|
|
if (!err) {
|
|
|
- let engineerTypeInfo = this.formatEngineeringWorkChooseValue(
|
|
|
- values.engineeringWorkChooseValue
|
|
|
- ); // 获取工种信息 typeConditionParentValue
|
|
|
let urlParams = {
|
|
|
engineertypeid: values.engineeringWorkChooseValue, // 工种
|
|
|
};
|
|
@@ -862,9 +860,9 @@ export default {
|
|
|
values.examTimeLong.minutes
|
|
|
).replace(' ', 'T'), // 结束日期
|
|
|
tages: [],
|
|
|
- engineerTypes: engineerTypeInfo ? [engineerTypeInfo] : [], // 信息集合:工种
|
|
|
+ engineerTypes: [values.engineeringWorkChooseValue], // 信息集合:工种
|
|
|
examCategory: values.examTypeChooseValue, // 考试类别
|
|
|
- totalpoints:
|
|
|
+ totalPoints:
|
|
|
this.questionInfo.singleNum * this.questionInfo.singleGrade +
|
|
|
this.questionInfo.multiNum * this.questionInfo.multiGrade +
|
|
|
this.questionInfo.trueFalseNum *
|
|
@@ -879,21 +877,6 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 获取工种信息
|
|
|
- formatEngineeringWorkChooseValue(id) {
|
|
|
- if (!id) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- let seleteItem = null;
|
|
|
- for (let i = 0; i < this.engineeringWorkList.length; i++) {
|
|
|
- let item = this.engineeringWorkList[i];
|
|
|
- if (item.id === id) {
|
|
|
- seleteItem = item;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return seleteItem;
|
|
|
- },
|
|
|
// 获取试题类型信息-子类
|
|
|
formatQuestionTypeConditionChooseValue(id) {
|
|
|
if (!id) {
|
|
@@ -918,8 +901,7 @@ export default {
|
|
|
params
|
|
|
)
|
|
|
.then((res) => {
|
|
|
- console.log(res);
|
|
|
- this.examId = res.id;
|
|
|
+ this.examId = res.data.id;
|
|
|
this.loading = false;
|
|
|
this.httpQuestPreAssembledVolumeFun(urlParams.engineertypeid); // 表单提交请求:预组卷
|
|
|
})
|
|
@@ -937,9 +919,7 @@ export default {
|
|
|
this.checkedQuestionTypeConditionChildren
|
|
|
); // 获取试题类型信息-子类
|
|
|
let params = {
|
|
|
- questionCategories: JSON.stringify(
|
|
|
- findCondition ? [findCondition] : []
|
|
|
- ), // 所选试题类型信息-子类
|
|
|
+ questionCategories: findCondition ? [findCondition] : [], // 所选试题类型信息-子类
|
|
|
totalQuestionNum:
|
|
|
Number(this.questionInfo.singleNum) +
|
|
|
Number(this.questionInfo.multiNum) +
|
|
@@ -961,26 +941,40 @@ export default {
|
|
|
params
|
|
|
)
|
|
|
.then((res) => {
|
|
|
- console.log(res.data);
|
|
|
let resData = res.data;
|
|
|
resData.forEach((item) => {
|
|
|
switch (item.type) {
|
|
|
case EXAM_QUESTION_TYPE[0].code:
|
|
|
- item.points = this.questionInfo.singleGrade;
|
|
|
+ item.points = this.questionInfo.singleGrade; // 分值
|
|
|
+ item.typeTxt = EXAM_QUESTION_TYPE[0].name; // 题目类别
|
|
|
break;
|
|
|
case EXAM_QUESTION_TYPE[1].code:
|
|
|
- item.points = this.questionInfo.multiNum;
|
|
|
+ item.points = this.questionInfo.multiGrade; // 分值
|
|
|
+ item.typeTxt = EXAM_QUESTION_TYPE[1].name; // 题目类别
|
|
|
break;
|
|
|
case EXAM_QUESTION_TYPE[2].code:
|
|
|
- item.points = this.questionInfo.trueFalseNum;
|
|
|
+ item.points = this.questionInfo.trueFalseGrade; // 分值
|
|
|
+ item.typeTxt = EXAM_QUESTION_TYPE[2].name; // 题目类别
|
|
|
break;
|
|
|
case EXAM_QUESTION_TYPE[3].code:
|
|
|
- item.points = this.questionInfo.gapFillingNum;
|
|
|
+ item.points = this.questionInfo.gapFillingGrade; // 分值
|
|
|
+ item.typeTxt = EXAM_QUESTION_TYPE[3].name; // 题目类别
|
|
|
break;
|
|
|
default:
|
|
|
- item.points = '';
|
|
|
+ item.points = ''; // 分值
|
|
|
+ item.typeTxt = '不限'; // 题目类别
|
|
|
break;
|
|
|
}
|
|
|
+ // 工种
|
|
|
+ if (item.engineerTypes) {
|
|
|
+ let findItem = formateEngineeringWork(
|
|
|
+ this.engineeringWorkList,
|
|
|
+ item.engineerTypes[0]
|
|
|
+ );
|
|
|
+ item.engineerTypeTxt = findItem.name;
|
|
|
+ } else {
|
|
|
+ item.engineerTypeTxt = '不限';
|
|
|
+ }
|
|
|
});
|
|
|
this.current_tableData = resData;
|
|
|
this.current_pagination.total = resData.length;
|
|
@@ -991,21 +985,21 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 表单提交请求:题目
|
|
|
- httpQuestAddQuestionsFun(examId) {
|
|
|
+ httpQuestAddQuestionsFun() {
|
|
|
this.loading = true;
|
|
|
let dataArr = [];
|
|
|
this.current_tableData.forEach((item) => {
|
|
|
let obj = {
|
|
|
- examId: examId,
|
|
|
+ examId: this.examId,
|
|
|
questionId: item.id,
|
|
|
- questionPoints: item.points,
|
|
|
+ questionPoints: Number(item.points),
|
|
|
};
|
|
|
dataArr.push(obj);
|
|
|
});
|
|
|
this.$_http
|
|
|
.post(
|
|
|
formatePathParams(this.$_API.INTERFACE_POST_EXAM_ADD_QUESTIONS, {
|
|
|
- examId,
|
|
|
+ examId: this.examId,
|
|
|
}),
|
|
|
dataArr
|
|
|
)
|