|
@@ -6,7 +6,7 @@
|
|
|
<div class="basic-information-title">基本信息</div>
|
|
|
<div class="basic-information-form">
|
|
|
<a-form
|
|
|
- :form="loginForm"
|
|
|
+ :form="examAutomaticVolumeFormationForm"
|
|
|
@submit="handleSubmitFun"
|
|
|
style="width: 515px;"
|
|
|
:loading="loading"
|
|
@@ -170,100 +170,99 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 试题数量 -->
|
|
|
- <div class="common-card a-card-margin-top other-information-box">
|
|
|
- <div class="other-information-title">题目数量</div>
|
|
|
- <div class="other-information-content">
|
|
|
- <div class="other-information-item">
|
|
|
- <span class="other-information-item-title">单选题:</span>
|
|
|
- <a-input
|
|
|
- v-model="questionInfo.singleNum"
|
|
|
- placeholder="输入数量"
|
|
|
- type="number"
|
|
|
- :max-length="3"
|
|
|
- style="width: 100px;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="other-information-item">
|
|
|
- <span class="other-information-item-title">每题分值:</span>
|
|
|
- <a-input
|
|
|
- v-model="questionInfo.singleGrade"
|
|
|
- placeholder="输入分值"
|
|
|
- type="number"
|
|
|
- :maxLength="3"
|
|
|
- style="width: 100px;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="other-information-content">
|
|
|
- <div class="other-information-item">
|
|
|
- <span class="other-information-item-title">多选题:</span>
|
|
|
- <a-input
|
|
|
- v-model="questionInfo.multiNum"
|
|
|
- placeholder="输入数量"
|
|
|
- type="number"
|
|
|
- :maxLength="3"
|
|
|
- style="width: 100px;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="other-information-item">
|
|
|
- <span class="other-information-item-title">每题分值:</span>
|
|
|
- <a-input
|
|
|
- v-model="questionInfo.multiGrade"
|
|
|
- placeholder="输入分值"
|
|
|
- type="number"
|
|
|
- :maxLength="3"
|
|
|
- style="width: 100px;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="other-information-content">
|
|
|
- <div class="other-information-item">
|
|
|
- <span class="other-information-item-title">判断题:</span>
|
|
|
- <a-input
|
|
|
- v-model="questionInfo.trueFalseNum"
|
|
|
- placeholder="输入数量"
|
|
|
- type="number"
|
|
|
- :maxLength="3"
|
|
|
- style="width: 100px;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="other-information-item">
|
|
|
- <span class="other-information-item-title">每题分值:</span>
|
|
|
- <a-input
|
|
|
- v-model="questionInfo.trueFalseGrade"
|
|
|
- placeholder="输入分值"
|
|
|
- type="number"
|
|
|
- :maxLength="3"
|
|
|
- style="width: 100px;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="other-information-content">
|
|
|
- <div class="other-information-item">
|
|
|
- <span class="other-information-item-title">填空题:</span>
|
|
|
- <a-input
|
|
|
- v-model="questionInfo.gapFillingNum"
|
|
|
- placeholder="输入数量"
|
|
|
- type="number"
|
|
|
- :maxLength="3"
|
|
|
- style="width: 100px;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="other-information-item">
|
|
|
- <span class="other-information-item-title">每题分值:</span>
|
|
|
- <a-input
|
|
|
- v-model="questionInfo.gapFillingGrade"
|
|
|
- placeholder="输入分值"
|
|
|
- type="number"
|
|
|
- :maxLength="3"
|
|
|
- style="width: 100px;"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="submit-row-PreAssembledVolume">
|
|
|
- <a-button type="primary" @click="handlePreAssembledVolumeFun"
|
|
|
- >预组卷</a-button
|
|
|
+ <div class="common-card a-card-margin-top basic-information-box">
|
|
|
+ <div class="basic-information-title">出题数量</div>
|
|
|
+ <div class="basic-information-form">
|
|
|
+ <a-form
|
|
|
+ :form="anserRuleSpecialNumForm"
|
|
|
+ @submit="handlePreAssembledVolumeFun"
|
|
|
+ style="width: 515px;"
|
|
|
+ :loading="loading"
|
|
|
+ :label-col="labelCol"
|
|
|
+ :wrapper-col="wrapperCol"
|
|
|
>
|
|
|
+ <a-form-item label="单选题">
|
|
|
+ <ExamQuestionNum
|
|
|
+ v-decorator="[
|
|
|
+ 'single',
|
|
|
+ {
|
|
|
+ initialValue: {
|
|
|
+ num: questionInfo.singleNum,
|
|
|
+ grade: questionInfo.singleGrade,
|
|
|
+ },
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ validator: checkExamQuestionNum,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="多选题">
|
|
|
+ <ExamQuestionNum
|
|
|
+ v-decorator="[
|
|
|
+ 'multi',
|
|
|
+ {
|
|
|
+ initialValue: {
|
|
|
+ num: questionInfo.multiNum,
|
|
|
+ grade: questionInfo.multiGrade,
|
|
|
+ },
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ validator: checkExamQuestionNum,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="判断题">
|
|
|
+ <ExamQuestionNum
|
|
|
+ v-decorator="[
|
|
|
+ 'trueFalse',
|
|
|
+ {
|
|
|
+ initialValue: {
|
|
|
+ num: questionInfo.trueFalseNum,
|
|
|
+ grade: questionInfo.trueFalseGrade,
|
|
|
+ },
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ validator: checkExamQuestionNum,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="填空题">
|
|
|
+ <ExamQuestionNum
|
|
|
+ v-decorator="[
|
|
|
+ 'gapFilling',
|
|
|
+ {
|
|
|
+ initialValue: {
|
|
|
+ num: questionInfo.gapFillingNum,
|
|
|
+ grade: questionInfo.gapFillingGrade,
|
|
|
+ },
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ validator: checkExamQuestionNum,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item :label-col="labelCol" :wrapper-col="{ span: 24 }">
|
|
|
+ <div class="submit-row">
|
|
|
+ <a-button type="primary" html-type="submit">预组卷</a-button>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 当前试题列表 -->
|
|
@@ -351,6 +350,7 @@ import {
|
|
|
formateEngineeringWork,
|
|
|
} from '@/filters';
|
|
|
import { mapGetters } from 'vuex';
|
|
|
+// 考试时长
|
|
|
const ExamTimeLong = {
|
|
|
props: ['value'],
|
|
|
template: `
|
|
@@ -407,20 +407,80 @@ const ExamTimeLong = {
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
+// 试题数量、分数
|
|
|
+const ExamQuestionNum = {
|
|
|
+ props: ['value'],
|
|
|
+ template: `
|
|
|
+ <span>
|
|
|
+ <a-input
|
|
|
+ type='number'
|
|
|
+ :value="num"
|
|
|
+ :maxLength="3"
|
|
|
+ @change="handleNumberChange"
|
|
|
+ style="width: 37%; margin-right: 2%;"
|
|
|
+ />
|
|
|
+ <span style="margin-left: 2%;">每题分值:</span>
|
|
|
+ <a-input
|
|
|
+ :value="grade"
|
|
|
+ :maxLength="3"
|
|
|
+ @change="handleCurrencyChange"
|
|
|
+ style="width: 37%;"
|
|
|
+ />
|
|
|
+ </span>
|
|
|
+ `,
|
|
|
+ data() {
|
|
|
+ const value = this.value || {};
|
|
|
+ return {
|
|
|
+ num: value.num,
|
|
|
+ grade: value.grade,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ value(val = {}) {
|
|
|
+ this.num = val.num;
|
|
|
+ this.grade = val.grade;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleNumberChange(e) {
|
|
|
+ const num = e.target.value;
|
|
|
+ if (isNaN(num)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.triggerChange({ num });
|
|
|
+ },
|
|
|
+ handleCurrencyChange(e) {
|
|
|
+ const grade = e.target.value;
|
|
|
+ if (isNaN(grade)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.triggerChange({ grade });
|
|
|
+ },
|
|
|
+ triggerChange(changedValue) {
|
|
|
+ // Should provide an event to pass value to Form.
|
|
|
+ this.$emit('change', Object.assign({}, this.$data, changedValue));
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
export default {
|
|
|
- name: 'examManualVolumeFormation',
|
|
|
+ name: 'examAutomaticVolumeFormation',
|
|
|
props: {},
|
|
|
components: {
|
|
|
ExamTimeLong,
|
|
|
+ ExamQuestionNum,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false, // 是否展示加载动画
|
|
|
// 基础信息的表单
|
|
|
- labelCol: { span: 6 }, // 表单行中label的占位
|
|
|
- wrapperCol: { span: 18 }, // 表单行中内容的占位
|
|
|
- loginForm: this.$form.createForm(this, {
|
|
|
- name: 'examManualVolumeFormation',
|
|
|
+ labelCol: { span: 4 }, // 表单行中label的占位
|
|
|
+ wrapperCol: { span: 20 }, // 表单行中内容的占位
|
|
|
+ examAutomaticVolumeFormationForm: this.$form.createForm(this, {
|
|
|
+ name: 'examAutomaticVolumeFormation',
|
|
|
+ }),
|
|
|
+
|
|
|
+ anserRuleSpecialNumForm: this.$form.createForm(this, {
|
|
|
+ name: 'answerManagementSpecialNum',
|
|
|
}),
|
|
|
engineeringWorkList: [], // 工种数据列表
|
|
|
examTypeList: [], // 考试类型列表
|
|
@@ -836,14 +896,47 @@ export default {
|
|
|
},
|
|
|
// #endregion
|
|
|
|
|
|
- // 操作:点击提交按钮
|
|
|
- handlePreAssembledVolumeFun() {
|
|
|
- document.getElementById('examManualVolumeFormation').click();
|
|
|
+ // 校验:考试试题数量
|
|
|
+ checkExamQuestionNum(rule, value, callback) {
|
|
|
+ if (
|
|
|
+ value.num !== '' &&
|
|
|
+ value.num >= 0 &&
|
|
|
+ value.grade !== '' &&
|
|
|
+ value.grade >= 0 &&
|
|
|
+ !(!value.num && !value.grade)
|
|
|
+ ) {
|
|
|
+ callback();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ callback('请输入完整的题目数量、题目分数');
|
|
|
+ },
|
|
|
+
|
|
|
+ // 操作:点击预组卷按钮
|
|
|
+ handlePreAssembledVolumeFun(e) {
|
|
|
+ // 验证:出题数量
|
|
|
+ e.preventDefault();
|
|
|
+ this.anserRuleSpecialNumForm.validateFields((err, values) => {
|
|
|
+ if (!err) {
|
|
|
+ console.log(values);
|
|
|
+ this.questionInfo = {
|
|
|
+ singleNum: values.single.num,
|
|
|
+ singleGrade: values.single.grade,
|
|
|
+ multiNum: values.multi.num,
|
|
|
+ multiGrade: values.multi.grade,
|
|
|
+ trueFalseNum: values.trueFalse.num,
|
|
|
+ trueFalseGrade: values.trueFalse.grade,
|
|
|
+ gapFillingNum: values.gapFilling.num,
|
|
|
+ gapFillingGrade: values.gapFilling.grade,
|
|
|
+ };
|
|
|
+ // 验证:基础信息
|
|
|
+ document.getElementById('examManualVolumeFormation').click();
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
// 操作:表单提交
|
|
|
handleSubmitFun(e) {
|
|
|
e.preventDefault();
|
|
|
- this.loginForm.validateFields((err, values) => {
|
|
|
+ this.examAutomaticVolumeFormationForm.validateFields((err, values) => {
|
|
|
if (!err) {
|
|
|
let that = this;
|
|
|
that.$confirm({
|