Commit f49dff97 authored by 黄奎's avatar 黄奎
parents a7d2bfc1 3d58ed53
...@@ -2,7 +2,12 @@ ...@@ -2,7 +2,12 @@
.examForm .q-table__bottom { .examForm .q-table__bottom {
min-height: 10px; min-height: 10px;
} }
.examForm .isOpen_Type{
color: var(--q-color-primary);
}
.examForm .q-breadcrumbs__el{
cursor: pointer;
}
</style> </style>
<template> <template>
<div class="page-content examForm"> <div class="page-content examForm">
...@@ -12,14 +17,12 @@ ...@@ -12,14 +17,12 @@
<template v-slot:top="props"> <template v-slot:top="props">
<template v-if="(navList&&navList.length>0)||(multipleSelection&&multipleSelection.length>0)"> <template v-if="(navList&&navList.length>0)||(multipleSelection&&multipleSelection.length>0)">
<div style="height:38px;display:flex;align-items:center;"> <div style="height:38px;display:flex;align-items:center;">
<div class="examPNav" v-if="navList&&navList.length>0" style="margin-right:20px;"> <div v-if="navList&&navList.length>0" style="margin-right:20px;">
<span @click="getPaperChild(0)">全部</span> > <q-breadcrumbs>
<template v-for="(item,index) in navList"> <q-breadcrumbs-el label="全部" @click="getPaperChild(0)" />
<span @click="getPaperChild(item.PaperId)" :class="{'lastExam':index==navList.length-1}" :key="index"> <q-breadcrumbs-el :label="item.PaperName" :class="{'lastExam':index==navList.length-1}"
{{item.PaperName}} @click="getPaperChild(item.PaperId)" v-for="(item,index) in navList" :key="index" />
</span> </q-breadcrumbs>
<span v-if="index!=navList.length-1" :key="index">></span>
</template>
</div> </div>
<div> <div>
<q-btn v-if="multipleSelection&&multipleSelection.length>0" color="accent" size="sm" class="q-mr-md" <q-btn v-if="multipleSelection&&multipleSelection.length>0" color="accent" size="sm" class="q-mr-md"
...@@ -61,7 +64,7 @@ ...@@ -61,7 +64,7 @@
<template v-slot:body-cell-QuestionCount="props"> <template v-slot:body-cell-QuestionCount="props">
<q-td :props="props"> <q-td :props="props">
<template v-if="props.row.PaperType==1"> <template v-if="props.row.PaperType==1">
--- <span style="color:gray">-</span>
</template> </template>
<template v-if="props.row.PaperType==2"> <template v-if="props.row.PaperType==2">
{{ props.row.QuestionCount }} {{ props.row.QuestionCount }}
...@@ -71,7 +74,7 @@ ...@@ -71,7 +74,7 @@
<template v-slot:body-cell-DifficultyTypeName="props"> <template v-slot:body-cell-DifficultyTypeName="props">
<q-td :props="props"> <q-td :props="props">
<template v-if="props.row.PaperType==1"> <template v-if="props.row.PaperType==1">
--- <span style="color:gray">-</span>
</template> </template>
<template v-if="props.row.PaperType==2"> <template v-if="props.row.PaperType==2">
{{ props.row.DifficultyTypeName }} {{ props.row.DifficultyTypeName }}
...@@ -81,7 +84,7 @@ ...@@ -81,7 +84,7 @@
<template v-slot:body-cell-PublishCount="props"> <template v-slot:body-cell-PublishCount="props">
<q-td :props="props"> <q-td :props="props">
<template v-if="props.row.PaperType==1"> <template v-if="props.row.PaperType==1">
--- <span style="color:gray">-</span>
</template> </template>
<template v-if="props.row.PaperType==2"> <template v-if="props.row.PaperType==2">
{{ props.row.PublishCount }} {{ props.row.PublishCount }}
...@@ -91,10 +94,10 @@ ...@@ -91,10 +94,10 @@
<template v-slot:body-cell-OpenStr="props"> <template v-slot:body-cell-OpenStr="props">
<q-td :props="props"> <q-td :props="props">
<template v-if="props.row.PaperType==1"> <template v-if="props.row.PaperType==1">
--- <span style="color:gray">-</span>
</template> </template>
<template v-if="props.row.PaperType==2"> <template v-if="props.row.PaperType==2">
{{ props.row.OpenStr }} <span :class="{'isOpen_Type':props.row.IsOpen==2}">{{ props.row.OpenStr }}</span>
</template> </template>
</q-td> </q-td>
</template> </template>
...@@ -117,8 +120,9 @@ ...@@ -117,8 +120,9 @@
v-if="currentUserInfo.Id==props.row.CreateBy" /> v-if="currentUserInfo.Id==props.row.CreateBy" />
</template> </template>
<template v-if="props.row.PaperType==2"> <template v-if="props.row.PaperType==2">
<q-btn flat size="xs" color="primary" style="font-weight:400" @click="goExameEdit(props.row)" label="编辑" <q-btn flat size="xs" color="primary" icon="edit" style="font-weight:400" @click="goExameEdit(props.row)" label="编辑"
v-if="currentUserInfo.Id==props.row.CreateBy &&(props.row.ExamineStatus==0||props.row.ExamineStatus==3||props.row.ExamineStatus==4)" /> v-if="currentUserInfo.Id==props.row.CreateBy &&(props.row.ExamineStatus==0||props.row.ExamineStatus==3||props.row.ExamineStatus==4)" />
<q-btn flat size="xs" color="primary" icon="iconfont icon-View" style="font-weight:400" @click="showPaperInfo(props.row)" label="详情"/>
</template> </template>
<q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left: 10px"> <q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left: 10px">
<q-list> <q-list>
...@@ -134,11 +138,6 @@ ...@@ -134,11 +138,6 @@
<q-item-label>发布考试</q-item-label> <q-item-label>发布考试</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item clickable v-close-popup @click="showPaperInfo(props.row)" v-if="props.row.PaperType==2">
<q-item-section>
<q-item-label>详情</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="movePaperInfo(props.row)" <q-item clickable v-close-popup @click="movePaperInfo(props.row)"
v-if="currentUserInfo.Id==props.row.CreateBy"> v-if="currentUserInfo.Id==props.row.CreateBy">
<q-item-section> <q-item-section>
...@@ -246,7 +245,7 @@ ...@@ -246,7 +245,7 @@
align: "left" align: "left"
}, { }, {
name: "PublishCount", name: "PublishCount",
label: "发布考试次数", label: "发布次数",
field: "PublishCount", field: "PublishCount",
align: "left" align: "left"
}, { }, {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat <q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat
class="sticky-column-table sticky-header-column-table" style="max-height: 550px" separator="none" :data="dataList" :columns="columns" class="sticky-column-table sticky-header-column-table" style="max-height: 440px" separator="none" :data="dataList" :columns="columns"
row-key="BankId" selection="multiple" :selected.sync="selectedQuestionBank"> row-key="BankId" selection="multiple" :selected.sync="selectedQuestionBank">
<template v-slot:top="props"> <template v-slot:top="props">
<div class="col-2 q-table__title">题库列表</div> <div class="col-2 q-table__title">题库列表</div>
...@@ -47,6 +47,12 @@ ...@@ -47,6 +47,12 @@
queryQuestionBankPage, queryQuestionBankPage,
} from '../../api/question/question'; } from '../../api/question/question';
export default { export default {
props: {
CheckedArray: {
type: Array,
default: null
},
},
data() { data() {
return { return {
persistent: true, persistent: true,
...@@ -83,6 +89,9 @@ ...@@ -83,6 +89,9 @@
} }
}, },
mounted() { mounted() {
if(this.CheckedArray&&this.CheckedArray.length>0){
this.selectedQuestionBank = this.CheckedArray;
}
this.getQuestionBankPage(); this.getQuestionBankPage();
}, },
methods: { methods: {
...@@ -115,10 +124,7 @@ ...@@ -115,10 +124,7 @@
var tempArray = []; var tempArray = [];
if (this.selectedQuestionBank && this.selectedQuestionBank.length > 0) { if (this.selectedQuestionBank && this.selectedQuestionBank.length > 0) {
this.selectedQuestionBank.forEach(item => { this.selectedQuestionBank.forEach(item => {
tempArray.push({ tempArray.push(item);
BankId: item.BankId,
BankName: item.BankName,
})
}) })
} }
this.$emit('success', tempArray); this.$emit('success', tempArray);
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
Id: 6 Id: 6
}, },
{ {
name: "完结的订单", name: "毕业",
Id: 7 Id: 7
}, },
{ {
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
} }
.lastExam { .lastExam {
color: #6B89B3;
cursor: default !important; cursor: default !important;
pointer-events: none; pointer-events: none;
} }
...@@ -67,7 +66,7 @@ ...@@ -67,7 +66,7 @@
<div class="col-3"> <div class="col-3">
<q-select v-model="msg.QCreateBy" <q-select v-model="msg.QCreateBy"
:options="EmployeeList" filled use-input label="创建人" @input="refreshPage" clearable option-label="EmployeeName" option-value="Id" :options="EmployeeList" filled use-input label="创建人" @input="refreshPage" clearable option-label="EmployeeName" option-value="Id"
ref="EmployeeName" class="col-6 q-pb-lg" emit-value map-options @filter="filterFn"> ref="EmployeeName" class="col-6" emit-value map-options @filter="filterFn">
<template v-slot:no-option> <template v-slot:no-option>
<q-item> <q-item>
<q-item-section class="text-grey"> <q-item-section class="text-grey">
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
} }
.lastExam { .lastExam {
color: #6B89B3;
cursor: default !important; cursor: default !important;
pointer-events: none; pointer-events: none;
} }
...@@ -37,7 +36,6 @@ ...@@ -37,7 +36,6 @@
.ExamPaper_Sysuser_Date .el-range-editor.el-input__inner { .ExamPaper_Sysuser_Date .el-range-editor.el-input__inner {
background-color: transparent; background-color: transparent;
} }
</style> </style>
<!--试卷库管理--> <!--试卷库管理-->
<template> <template>
......
...@@ -2,18 +2,25 @@ ...@@ -2,18 +2,25 @@
<style> <style>
.examCreat_Top { .examCreat_Top {
width: 100%; width: 100%;
height: 30px; height: 40px;
line-height: 30px; line-height: 35px;
padding: 0 10px; padding: 0 10px;
margin-bottom: 20px; margin-bottom: 20px;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
display: flex;
justify-content: space-between;
align-items: center;
font-size:20px;
} }
.examTi_List { .examTi_List {
border: 1px solid #ddd; border: 1px solid #ddd;
margin-bottom: 20px; margin-bottom: 20px;
} }
.examCreat_Top i{
color: var(--q-color-negative);
font-size: 20px;
}
.examCreat_Top i:hover { .examCreat_Top i:hover {
color: red; color: red;
cursor: pointer; cursor: pointer;
...@@ -24,7 +31,7 @@ ...@@ -24,7 +31,7 @@
padding-top: 12px; padding-top: 12px;
border-radius: 4px; border-radius: 4px;
padding: 12px 4px 0 4px; padding: 12px 4px 0 4px;
margin: 20px 0 10px 68px; margin: 20px 0 10px 60px;
} }
.setpaperCreat span { .setpaperCreat span {
...@@ -40,19 +47,39 @@ ...@@ -40,19 +47,39 @@
font-size: 12px; font-size: 12px;
} }
.paperCreate .EmpLine_title {
display: flex;
align-items: center;
font-size: 12px;
margin-bottom: 20px;
}
.paperCreate .Emp_Line {
width: 3px;
height: 10px;
background-color: #3FC4FF;
margin-right: 10px;
}
</style> </style>
<template> <template>
<div class="page-body"> <div class="page-body paperCreate">
<div> <div style="display:flex;justify-content:space-between;">
组卷题库 <div>
<q-btn color="accent" size="sm" @click="showQuestionBank" class="q-mr-md" label="选择题库"  /><br /> 组卷题库
<q-btn color="accent" size="sm" @click="showQuestionBank" class="q-mr-md" label="选择题库"  />
</div>
<div>
<q-btn color="accent" size="sm" @click="showExamTemplate" label="选择模板" />
</div>
</div> </div>
<div class="setpaperCreat" v-if="QuestionArray.length>0"> <div class="setpaperCreat" v-if="QuestionArray.length>0">
<span v-for="(item,index) in QuestionArray" :key="index">{{item.BankName}}</span> <span v-for="(item,index) in QuestionArray" :key="index">{{item.BankName}}</span>
</div> </div>
<q-btn color="accent" size="sm" style="margin-top:20px;"  @click="showExamTemplate"  class="q-mr-md"  label="选择模板"
  /><br />
<br /> <br />
<div class="EmpLine_title">
<div class="Emp_Line"></div>
<div>基本信息</div>
</div>
<div class="row"> <div class="row">
<q-input filled stack-label maxlength="100" :dense="false" v-model="templateMsg.TemplateName" <q-input filled stack-label maxlength="100" :dense="false" v-model="templateMsg.TemplateName"
class="col-6 q-pb-lg q-pr-lg" label="试卷标题" /> class="col-6 q-pb-lg q-pr-lg" label="试卷标题" />
...@@ -61,32 +88,36 @@ ...@@ -61,32 +88,36 @@
</div> </div>
<div class="row"> <div class="row">
<q-input filled stack-label maxlength="5" :dense="false" ref="TemplateNum" v-model="templateMsg.TemplateNum" <q-input filled stack-label maxlength="5" :dense="false" ref="TemplateNum" v-model="templateMsg.TemplateNum"
class="col-6 q-pb-lg q-pr-lg" label="随机组卷数量" @keyup.native="checkInteger(templateMsg,'TemplateNum')" class="col-6 q-pb-lg q-pr-lg" label="随机组卷数量" @keyup.native="checkInteger(templateMsg,'TemplateNum')" />
:rules="[val => !!val || '请填写随机组卷数量']" />
<q-select filled option-value="Id" option-label="Name" :options="questionDifficultyTypeList" emit-value <q-select filled option-value="Id" option-label="Name" :options="questionDifficultyTypeList" emit-value
map-options label="难易程度" class="col-6" use-input clearable v-model="templateMsg.TemplateDifficultyType" /> map-options label="难易程度" class="col-6" use-input clearable v-model="templateMsg.TemplateDifficultyType" />
</div> </div>
<div class="EmpLine_title">
<div class="Emp_Line"></div>
<div>试卷配置</div>
</div>
<!-- 分割线<br /> --> <!-- 分割线<br /> -->
<template v-if="templateMsg&&templateMsg.TemplateData&&templateMsg.TemplateData.length>0"> <template v-if="templateMsg&&templateMsg.TemplateData&&templateMsg.TemplateData.length>0">
<div v-for="(item,index) in templateMsg.TemplateData" :key="index" class="examTi_List"> <div v-for="(item,index) in templateMsg.TemplateData" :key="index" class="examTi_List">
<div class="examCreat_Top"> <div class="examCreat_Top">
<span>{{item.QuestionTypeName}}</span> &nbsp;&nbsp;<i @click="delQuestion(templateMsg.TemplateData,index)" <div>{{item.QuestionTypeName}}</div>
class="iconfont icon-img_delete_small"></i> <div><i @click="delQuestion(templateMsg.TemplateData,index)"
class="iconfont icon-img_delete_small"></i></div>
</div> </div>
<div style="padding:0 20px 10px 20px;"> <div style="padding:0 20px 10px 20px;">
<div class="row"> <div class="row">
<q-input filled stack-label maxlength="5" :dense="false" v-model="item.QuestionScore" <q-input filled stack-label maxlength="5" :dense="false" v-model="item.QuestionScore"
class="col-6 q-pb-lg q-pr-lg" label="总分" @keyup.native="checkInteger(item,'QuestionScore')" /> class="col-6 q-pb-lg q-pr-lg" label="总分" @keyup.native="checkInteger(item,'QuestionScore')" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="item.QuestionDesc" class="col-6 q-pb-lg" <q-input filled stack-label maxlength="100" :dense="false" v-model="item.QuestionDesc" class="col-6 q-pb-lg"
label="题型说明" /> label="题干信息" />
</div> </div>
<span> <span>
<q-radio v-model="item.ChooseType" :val="1" label="从题库选题" /> <q-radio v-model="item.ChooseType" :val="1" label="从题库选题" />
<template v-if="item.ChooseType==1"> <template v-if="item.ChooseType==1">
<span style="position:relative;top:2px;">{{item.QuestionTypeNum}} 道 抽 <span style="position:relative;top:2px;">{{item.QuestionTypeNum}} 道 抽
<el-input style="width:100px;" size="small" :disabled="templateMsg.TemplateBankIds!=''&&item.QuestionTypeNum<=0" <el-input style="width:100px;" size="small"
@input="getMaxInput(item)" v-model="item.ChooseNum" @keyup.native="checkInteger(item,'ChooseNum')" :disabled="templateMsg.TemplateBankIds!=''&&item.QuestionTypeNum<=0" @input="getMaxInput(item)"
maxlength="5"></el-input> v-model="item.ChooseNum" @keyup.native="checkInteger(item,'ChooseNum')" maxlength="5"></el-input>
&nbsp;&nbsp;</span> &nbsp;&nbsp;</span>
</template> </template>
</span> </span>
...@@ -97,7 +128,8 @@ ...@@ -97,7 +128,8 @@
<div style="margin:0 0 20px 40px;" v-for="(subItem,subIndex) in item.ChooseList" :key="subIndex"> <div style="margin:0 0 20px 40px;" v-for="(subItem,subIndex) in item.ChooseList" :key="subIndex">
{{subItem.DifficultyTypeName}} (共 {{subItem.DifficultyTypeName}} (共
{{subItem.DifficultyTypeCount}} 道) 抽 {{subItem.DifficultyTypeCount}} 道) 抽
<el-input style="width:100px;" size="small" :disabled="templateMsg.TemplateBankIds!=''&&subItem.DifficultyTypeCount<=0" <el-input style="width:100px;" size="small"
:disabled="templateMsg.TemplateBankIds!=''&&subItem.DifficultyTypeCount<=0"
@input="getMaxMiniInput(subItem)" @keyup.native="checkInteger(subItem,'ChooseNum')" @input="getMaxMiniInput(subItem)" @keyup.native="checkInteger(subItem,'ChooseNum')"
v-model="subItem.ChooseNum" maxlength="5"></el-input> v-model="subItem.ChooseNum" maxlength="5"></el-input>
&nbsp;&nbsp; &nbsp;&nbsp;
...@@ -107,25 +139,36 @@ ...@@ -107,25 +139,36 @@
</div> </div>
</div> </div>
</template> </template>
<div class="row"> <div class="row">
<q-select filled option-value="QId" option-label="Name" :options="questionTypeList" emit-value map-options <div class="col-6">
label="更多题型" class="col-6 q-pr-lg" use-input clearable v-model="MoreQuestionTypeId" @input="changeQuestion" /> <q-btn-dropdown color="primary" label="添加题型">
<div class="row col-6" style="align-items:center;"> <q-list>
<div class="col-6"> <q-item clickable v-close-popup @click="onItemClick(item)" v-for="(item,index) in questionTypeList"
<q-radio v-model="templateMsg.IsOpen" :val="1" label="私有" /> :key="index">
<q-radio v-model="templateMsg.IsOpen" :val="2" label="公开" /> <q-item-section>
</div> <q-item-label>{{item.Name}}</q-item-label>
<div class="col-6"> </q-item-section>
<q-checkbox v-model="templateMsg.IsSaveTemplate" label="同时保存为组卷模板" /> </q-item>
</div> </q-list>
</q-btn-dropdown>
</div>
</div>
<div class="row q-mt-lg">
<div class="col-6">
<span>开放状态</span>
<q-radio v-model="templateMsg.IsOpen" :val="1" label="私有" />
<q-radio v-model="templateMsg.IsOpen" :val="2" label="公开" />
</div>
<div class="col-6">
<q-checkbox v-model="templateMsg.IsSaveTemplate" label="同时保存为组卷模板" />
</div> </div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<q-btn color="accent" size="sm" @click="setPaperTemplate" class="q-mr-md" label="保存" :loading="saveLoading" /> <q-btn color="accent" @click="setPaperTemplate" class="q-mr-md" label="保存" :loading="saveLoading" />
</div> </div>
<questionbankForm v-if="isShowQuestionBank"  @close="closeExamForm"  @success="getBankData"> <questionbankForm v-if="isShowQuestionBank"  @close="closeExamForm" :CheckedArray="QuestionArray"
 @success="getBankData">
</questionbankForm> </questionbankForm>
<examtemplateForm v-if="isShowExamTemplate"  @close="closeExamForm"  @success="getTemplateData"> <examtemplateForm v-if="isShowExamTemplate"  @close="closeExamForm"  @success="getTemplateData">
</examtemplateForm> </examtemplateForm>
...@@ -171,7 +214,6 @@ ...@@ -171,7 +214,6 @@
}, },
ShowBankName: "", //显示题库名称 ShowBankName: "", //显示题库名称
BankList: [], BankList: [],
MoreQuestionTypeId: "", //更多题型
questionTypeList: [], //问题列表 questionTypeList: [], //问题列表
saveLoading: false, saveLoading: false,
QuestionArray: [] QuestionArray: []
...@@ -192,12 +234,12 @@ ...@@ -192,12 +234,12 @@
methods: { methods: {
//设置最大值 //设置最大值
getMaxInput(item) { getMaxInput(item) {
if (templateMsg.TemplateBankIds!=''&& item.ChooseNum > item.QuestionTypeNum) { if (templateMsg.TemplateBankIds != '' && item.ChooseNum > item.QuestionTypeNum) {
item.ChooseNum = ''; item.ChooseNum = '';
} }
}, },
getMaxMiniInput(item) { getMaxMiniInput(item) {
if (templateMsg.TemplateBankIds!=''&&item.ChooseNum > item.DifficultyTypeCount) { if (templateMsg.TemplateBankIds != '' && item.ChooseNum > item.DifficultyTypeCount) {
item.ChooseNum = ''; item.ChooseNum = '';
} }
}, },
...@@ -209,40 +251,54 @@ ...@@ -209,40 +251,54 @@
} }
}); });
}, },
//选择添加题型 //点击添加题型
changeQuestion() { onItemClick(myObj) {
if (this.MoreQuestionTypeId && this.MoreQuestionTypeId != '') { //获取问题类型
//获取问题类型 var qTypeObj = this.questionTypeList.find((item) => {
var qTypeObj = this.questionTypeList.find((item) => { return item.QId === myObj.QId;
return item.QId === this.MoreQuestionTypeId; });
}); var newObj = this.createdTempObj();
var newObj = this.createdTempObj(); if (qTypeObj) {
if (qTypeObj) { newObj.QuestionTypeId = qTypeObj.QId;
newObj.QuestionTypeId = qTypeObj.QId; newObj.QuestionTypeKey = qTypeObj.Key;
newObj.QuestionTypeKey = qTypeObj.Key; newObj.QuestionTypeName = qTypeObj.Name;
newObj.QuestionTypeName = qTypeObj.Name; }
} //获取题库中的题型
//获取题库中的题型 var chooseQuestion = this.BankList.find((item) => {
var chooseQuestion = this.BankList.find((item) => { return item.QuestionTypeId === myObj.QId;
return item.QuestionTypeId === this.MoreQuestionTypeId; });
}); //题库中有此题型
//题库中有此题型 if (chooseQuestion) {
if (chooseQuestion) { newObj.QuestionTypeNum = chooseQuestion.QuestionTypeNum;
newObj.QuestionTypeNum = chooseQuestion.QuestionTypeNum; newObj.ChooseList = chooseQuestion.ChooseList;
newObj.ChooseList = chooseQuestion.ChooseList; }
} if (newObj && newObj.QuestionTypeId > 0) {
if (newObj && newObj.QuestionTypeId > 0) { if (!this.checkExists(newObj.QuestionTypeId)) {
if (!this.checkExists(newObj.QuestionTypeId)) { this.templateMsg.TemplateData.push(newObj);
this.templateMsg.TemplateData.push(newObj); } else {
} else { this.$q.notify({
this.$q.notify({ type: 'negative',
type: 'negative', position: "top",
position: "top", message: `已存在此题型,请勿重复选择!`
message: `已存在此题型,请勿重复选择!` })
})
}
} }
} }
this.filterChecked();
},
//过滤已经选中
filterChecked(){
var NewData = JSON.parse(JSON.stringify(this.questionTypeList));
let newArray = [];
if((this.templateMsg.TemplateData&&this.templateMsg.TemplateData.length>0)&&(NewData&&NewData.length>0)){
this.templateMsg.TemplateData.forEach(x=>{
NewData.forEach((y,index)=>{
if(x.QuestionTypeId==y.QId){
NewData.splice(index,1);
}
})
})
}
this.questionTypeList = NewData;
}, },
//创建模板对象 //创建模板对象
createdTempObj() { createdTempObj() {
...@@ -395,58 +451,64 @@ ...@@ -395,58 +451,64 @@
newObj.ChooseList = chooseQuestion.ChooseList; newObj.ChooseList = chooseQuestion.ChooseList;
} }
this.templateMsg.TemplateData.push(newObj); this.templateMsg.TemplateData.push(newObj);
this.filterChecked();
}); });
} }
} }
}, },
//根据模板生成试卷 //根据模板生成试卷
setPaperTemplate() { setPaperTemplate() {
this.$refs.TemplateNum.validate() if (this.templateMsg.TemplateNum == '') {
if (!this.$refs.TemplateNum.hasError) { this.$q.notify({
let TotalNum = 0; type: 'negative',
for (let i = 0; i < this.templateMsg.TemplateData.length; i++) { position: "top",
if (this.templateMsg.TemplateData[i].ChooseType == 1 && this.templateMsg.TemplateData[i].ChooseNum === '') { message: `请填写随机组卷数量`
this.$q.notify({ })
type: 'negative', return
position: "top", }
message: `请填写第${i+1}题的抽取数` let TotalNum = 0;
}) for (let i = 0; i < this.templateMsg.TemplateData.length; i++) {
return if (this.templateMsg.TemplateData[i].ChooseType == 1 && this.templateMsg.TemplateData[i].ChooseNum === '') {
}
TotalNum += parseInt(this.templateMsg.TemplateData[i].QuestionScore);
}
if (TotalNum > this.templateMsg.TemplateScore) {
this.$q.notify({ this.$q.notify({
type: 'negative', type: 'negative',
position: "top", position: "top",
message: `题目总分之和大于满分` message: `请填写第${i+1}题的抽取数`
}) })
return return
} }
this.saveLoading = true; TotalNum += parseInt(this.templateMsg.TemplateData[i].QuestionScore);
savePaperTemplate(this.templateMsg).then(res => { }
this.saveLoading = false; if (TotalNum > this.templateMsg.TemplateScore) {
if (res.Code == 1) { this.$q.notify({
this.$q.notify({ type: 'negative',
icon: 'iconfont icon-chenggong', position: "top",
color: 'accent', message: `题目总分之和大于满分`
timeout: 2000, })
message: '创建试卷成功!', return
position: 'top'
})
this.$router.push({
path: '/exam/examPaper',
query: {}
});
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: `操作失败!`
})
}
});
} }
this.saveLoading = true;
savePaperTemplate(this.templateMsg).then(res => {
this.saveLoading = false;
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '创建试卷成功!',
position: 'top'
})
this.$router.push({
path: '/exam/examPaper',
query: {}
});
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: `操作失败!`
})
}
});
}, },
//删除 //删除
delQuestion(item, index) { delQuestion(item, index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment