Commit c07399bf authored by 黄奎's avatar 黄奎

页面修改

parent efc6234b
......@@ -243,12 +243,24 @@ export function saveBatchQuestionLevel(data) {
}
/**
* 根据题库编号获取题库题型分类列表【试卷组卷使用】
* 根据题库编号获取题库题型列表(单选题、多选题、等)【试卷组卷使用】
* @param {*} data
*/
export function queryQuestionCategoryList(data) {
export function queryQuestionTypeStaticList(data) {
return request({
url: '/Question/GetQuestionCategoryList',
url: '/Question/GetQuestionTypeStaticList',
method: 'post',
data
})
}
/**
* 根据题库编号获取题库题型分类列表(读音选择题、汉字选择题等)【试卷组卷使用】
* @param {*} data
*/
export function queryQuestionCategoryStaticList(data) {
return request({
url: '/Question/GetQuestionCategoryStaticList',
method: 'post',
data
})
......
......@@ -314,9 +314,9 @@
methods: {
//是否可修改
isEdit(item) {
// if (this.currentUserInfo.Id == 1) {
// return true;
// }
if (this.currentUserInfo.Id == 1) {
return true;
}
return this.currentUserInfo.Id == item.CreateBy &&
(item.ExamineStatus == 0 || item.ExamineStatus == 3 || item.ExamineStatus == 4)
},
......
......@@ -20,7 +20,8 @@
</template>
<template v-slot:body-cell-optioned="props">
<q-td :props="props">
<q-btn flat size="xs" v-if="props.row.IsEdit==1" color="accent" style="font-weight: 400" label="修改" @click="publishExam(props.row)" />
<!--v-if="props.row.IsEdit==1"-->
<q-btn flat size="xs" color="accent" style="font-weight: 400" label="修改" @click="publishExam(props.row)" />
<q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left: 10px">
<q-list>
<q-item clickable v-close-popup @click="submitExamAudit(props.row)"
......
......@@ -98,20 +98,24 @@
<div class="EmpLine_title">
<div class="Emp_Line"></div>
<div>试卷配置</div>
<q-radio v-model="templateMsg.GroupType" :val="1" label="问题类型" @input="getQuestionTypeStaticList" />
<q-radio v-model="templateMsg.GroupType" :val="2" label="题目大类" @input="getQuestionCategoryStaticList" />
</div>
<template v-if="templateMsg.GroupType==1">
<!-- 分割线<br /> -->
<template v-if="templateMsg&&templateMsg.TemplateData&&templateMsg.TemplateData.length>0">
<div v-for="(item,index) in templateMsg.TemplateData" :key="index" class="examTi_List">
<div class="examCreat_Top">
<div>{{item.QuestionTypeName}}</div>
<div><i @click="delQuestion(templateMsg.TemplateData,index)" class="iconfont icon-img_delete_small"></i></div>
<div><i @click="delQuestion(templateMsg.TemplateData,index)" class="iconfont icon-img_delete_small"></i>
</div>
</div>
<div style="padding:0 20px 10px 20px;">
<div class="row">
<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')" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="item.QuestionDesc" class="col-6 q-pb-lg"
label="题干信息" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="item.QuestionDesc"
class="col-6 q-pb-lg" label="题干信息" />
</div>
<span>
<q-radio v-model="item.ChooseType" :val="1" label="从题库选题" />
......@@ -138,16 +142,61 @@
</div>
</template>
</span>
</div>
</div>
</template>
<div class="row">
<div class="col-6">
<q-btn-dropdown color="primary" label="添加题型">
<q-list>
<q-item clickable v-close-popup @click="onItemClick(item)" v-for="(item,index) in newQuestionTypeList"
:key="index">
<q-item-section>
<q-item-label>{{item.Name}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
</div>
</template>
<template v-if="templateMsg.GroupType==2">
<!-- 分割线<br /> -->
<template v-if="templateMsg&&templateMsg.TemplateData&&templateMsg.TemplateData.length>0">
<div v-for="(item,index) in templateMsg.TemplateData" :key="index" class="examTi_List">
<div class="examCreat_Top">
<div>{{item.QuestionTypeName}}</div>
<div><i @click="delQuestion(templateMsg.TemplateData,index)" class="iconfont icon-img_delete_small"></i>
</div>
</div>
<div style="padding:0 20px 10px 20px;">
<div class="row">
<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')" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="item.QuestionDesc"
class="col-6 q-pb-lg" label="题干信息" />
</div>
<span>
<q-radio v-model="item.ChooseType" :val="1" label="从题库选题" />
<template v-if="item.ChooseType==1">
<span style="position:relative;top:2px;">{{item.QuestionTypeNum}} 道 抽
<el-input style="width:100px;" size="small"
:disabled="templateMsg.TemplateBankIds!=''&&item.QuestionTypeNum<=0" @input="getMaxInput(item)"
v-model="item.ChooseNum" @keyup.native="checkInteger(item,'ChooseNum')" maxlength="5"></el-input>
&nbsp;&nbsp;</span>
</template>
</span>
<br />
<span>
<q-radio v-model="item.ChooseType" :val="3" label="从题库按照分类选题" />
<template v-if="item.ChooseType==3">
<div style="margin:0 0 20px 40px;" v-for="(subItem,subIndex) in item.CategoryList" :key="subIndex">
{{subItem.CategoryName}} (共
{{subItem.QuestionTypeNum}} 道) 抽
<el-input style="width:100px;" size="small" @input="getMaxMiniCategoryInput(subItem)"
@keyup.native="checkInteger(subItem,'ChooseNum')" v-model="subItem.ChooseNum" maxlength="5">
</el-input>
<q-radio v-model="item.ChooseType" :val="2" label="从题库按照难易度选题" />
<template v-if="item.ChooseType==2">
<div style="margin:0 0 20px 40px;" v-for="(subItem,subIndex) in item.ChooseList" :key="subIndex">
{{subItem.DifficultyTypeName}} (共
{{subItem.DifficultyTypeCount}} 道) 抽
<el-input style="width:100px;" size="small"
:disabled="templateMsg.TemplateBankIds!=''&&subItem.DifficultyTypeCount<=0"
@input="getMaxMiniInput(subItem)" @keyup.native="checkInteger(subItem,'ChooseNum')"
v-model="subItem.ChooseNum" maxlength="5"></el-input>
&nbsp;&nbsp;
</div>
</template>
......@@ -157,18 +206,20 @@
</template>
<div class="row">
<div class="col-6">
<q-btn-dropdown color="primary" label="添加题型">
<q-btn-dropdown color="primary" label="添加分类">
<q-list>
<q-item clickable v-close-popup @click="onItemClick(item)" v-for="(item,index) in questionTypeList"
:key="index">
<q-item clickable v-close-popup @click="onCategoryItemClick(item)"
v-for="(item,index) in newQuestionCategoryList" :key="index">
<q-item-section>
<q-item-label>{{item.Name}}</q-item-label>
<q-item-label>{{item.QuestionTypeName}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
</div>
</template>
<div class="row q-mt-lg">
<div class="col-6">
<span>开放状态</span>
......@@ -196,7 +247,8 @@
import {
queryQuestionTypeList,
queryDifficultyType,
queryQuestionCategoryList
queryQuestionTypeStaticList,
queryQuestionCategoryStaticList
} from '../../api/question/question'
import {
savePaperInfo,
......@@ -220,6 +272,7 @@
questionDifficultyTypeList: [], //难易程度列表
//模板数据
templateMsg: {
GroupType: 1, //类型(1-题目类型,2-题目大分类)'
TemplateId: 0, //模板编号
TemplateName: "", //模板名称
TemplateScore: 100, //模板分数
......@@ -234,9 +287,43 @@
ShowBankName: "", //显示题库名称
BankList: [],
questionTypeList: [], //问题列表
quastionCategory: [], //问题大类
saveLoading: false,
QuestionArray: [],
AllquestionTypeList: []
}
},
computed: {
//获取计算后的问题类型(单选题、多选他)
newQuestionTypeList() {
let newArray = JSON.parse(JSON.stringify(this.questionTypeList));
if (newArray && newArray.length > 0) {
if (this.templateMsg.TemplateData && this.templateMsg.TemplateData.length > 0) {
this.templateMsg.TemplateData.forEach(x => {
newArray.forEach((qItem, index) => {
if (x.QuestionTypeId == qItem.QId) {
newArray.splice(index, 1);
}
})
})
}
}
return newArray;
},
//获取计算后的问题分类(读音选择题、汉字选择题等)
newQuestionCategoryList() {
let newArray = JSON.parse(JSON.stringify(this.quastionCategory));
if (newArray && newArray.length > 0) {
if (this.templateMsg.TemplateData && this.templateMsg.TemplateData.length > 0) {
this.templateMsg.TemplateData.forEach(x => {
newArray.forEach((qItem, index) => {
if (x.QuestionTypeId == qItem.QuestionTypeId) {
newArray.splice(index, 1);
}
})
})
}
}
return newArray;
}
},
created() {
......@@ -247,7 +334,8 @@
}
this.getQuestionType();
this.getDifficultyType();
this.getQuestionCategoryList();
this.getQuestionCategoryStaticList();
this.getQuestionTypeStaticList();
},
mounted() {
var timeStr = date.formatDate(Date.now(), "YYYYMMDDHHmmss");
......@@ -266,18 +354,11 @@
item.ChooseNum = item.DifficultyTypeCount;
}
},
//分类
getMaxMiniCategoryInput(item) {
if (item.ChooseNum > item.QuestionTypeNum) {
item.ChooseNum = item.QuestionTypeNum;
}
},
//获取题型列表
getQuestionType() {
queryQuestionTypeList({}).then(res => {
if (res.Code == 1) {
this.questionTypeList = res.Data;
this.AllquestionTypeList = res.Data;
}
});
},
......@@ -314,28 +395,35 @@
})
}
}
this.filterChecked();
},
//过滤已经选中
filterChecked(type) {
var NewData = [];
if (type == 1) {
NewData = JSON.parse(JSON.stringify(this.AllquestionTypeList));
} else {
NewData = JSON.parse(JSON.stringify(this.questionTypeList));
//添加分类
onCategoryItemClick(myObj) {
var newObj = this.createdTempObj();
if (myObj) {
newObj.QuestionTypeId = myObj.QuestionTypeId;
newObj.QuestionTypeKey = myObj.QuestionTypeKey;
newObj.QuestionTypeName = myObj.QuestionTypeName;
}
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);
//获取题库中的题型
var chooseQuestion = this.BankList.find((item) => {
return item.QuestionTypeId === myObj.QuestionTypeId;
});
//题库中有此题型
if (chooseQuestion) {
newObj.QuestionTypeNum = chooseQuestion.QuestionTypeNum;
newObj.ChooseList = chooseQuestion.ChooseList;
}
if (newObj && newObj.QuestionTypeId > 0) {
if (!this.checkExists(newObj.QuestionTypeId)) {
this.templateMsg.TemplateData.push(newObj);
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: `已存在此题型,请勿重复选择!`
})
})
}
this.questionTypeList = NewData;
}
},
//创建模板对象
createdTempObj() {
......@@ -367,7 +455,6 @@
ChooseNum: 0
}
],
CategoryList: []
}
return newObj;
},
......@@ -385,12 +472,37 @@
}
return isExists;
},
//获取题库题目分类列表
getQuestionCategoryList() {
//获取题目(汉字选择题、读音选择题等)列表
getQuestionCategoryStaticList() {
var qMsg = {
QBankIds: this.templateMsg.TemplateBankIds
}
queryQuestionCategoryList(qMsg).then(res => {
this.BankList = [];
this.templateMsg.TemplateData = [];
queryQuestionCategoryStaticList(qMsg).then(res => {
if (res.Code == 1) {
var tempArray = res.Data;
if (tempArray && tempArray.length > 0) {
this.quastionCategory = tempArray;
this.BankList = tempArray;
tempArray.forEach(item => {
//默认添加【单选题,多选题、填空题,单选题(数字)】
if (item.QuestionTypeId == 1 || item.QuestionTypeKey == 2) {
this.templateMsg.TemplateData.push(item);
}
})
}
}
});
},
//获取题库题目题型(单选题、多选题等)列表
getQuestionTypeStaticList() {
var qMsg = {
QBankIds: this.templateMsg.TemplateBankIds
}
this.BankList = [];
this.templateMsg.TemplateData = [];
queryQuestionTypeStaticList(qMsg).then(res => {
if (res.Code == 1) {
var tempArray = res.Data;
if (tempArray && tempArray.length > 0) {
......@@ -421,14 +533,6 @@
},
//显示试卷模板
showExamTemplate() {
// if (this.templateMsg.TemplateBankIds == '') {
// this.$q.notify({
// type: 'negative',
// position: "top",
// message: `请先选择题库`
// })
// return;
// }
this.isShowExamTemplate = true;
},
//关闭题库
......@@ -456,7 +560,6 @@
}
this.templateMsg.TemplateBankIds = qBankIds;
this.ShowBankName = sBankName;
this.getQuestionCategoryList();
},
//获取模板数据
getTemplateData(tempObj) {
......@@ -489,7 +592,6 @@
newObj.ChooseList = chooseQuestion.ChooseList;
}
this.templateMsg.TemplateData.push(newObj);
this.filterChecked();
});
}
}
......@@ -598,7 +700,6 @@
cancel: "取消",
}).onOk(() => {
item.splice(index, 1);
this.filterChecked(1);
}).onCancel(() => {});
}
}
......
......@@ -280,6 +280,11 @@
<q-radio v-model="DataObj.IsOpen" :val="1" label="私有" />
<q-radio v-model="DataObj.IsOpen" :val="2" label="公开" />
</div>
<div style="margin:8px 0 0 20px">
组卷类型:
<q-radio v-model="DataObj.GroupType" :val="1" label="问题类型" />
<q-radio v-model="DataObj.GroupType" :val="2" label="题目大类" />
</div>
</div>
<div style="width:20%;text-align:right;">
<q-btn color="accent" size="sm" class="q-mr-md" label="预览" style="display:none;" />
......@@ -292,6 +297,16 @@
<p class="Left-ptitel">
<span>题量:<i>{{examNum}}</i></span>
<span>  总分:<i>{{examScore.toFixed(2)}}</i></span>
<q-btn-dropdown color="primary" label="添加分类">
<q-list>
<q-item clickable v-close-popup @click="onCategoryItemClick(item)"
v-for="(item,index) in newQuestionCategoryList" :key="index">
<q-item-section>
<q-item-label>{{item.Name}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</p>
<div class="Left-list">
<template v-if="DataObj&&DataObj.GroupList&&DataObj.GroupList.length>0">
......@@ -299,9 +314,11 @@
<div class="List-bt">
<div class="paperEdit_Top">
<template v-if="!gItem.isShowEdit">
<div @click="GetGroupItem(gItem)">
<div>{{gIndex+1}}</div>&nbsp;
<div class="paper_GroupName" :title="gItem.GroupName">{{gItem.GroupName}}</div>
<div>(共{{ gItem.DetailsList?gItem.DetailsList.length:0 }}题,{{gItem.GScore}}分)</div>
</div>
</template>
<template v-else>
<el-input v-model="gItem.GroupName" size="small" maxlength="50"
......@@ -575,7 +592,9 @@
PaperType: 2, //试卷类型(1-文件夹,2-试卷)
ParentId: 0, //父节点编号,
GroupList: [], //试卷答题分类
IsOpen: 1 //(1-私有,2-开放)
IsOpen: 1, //(1-私有,2-开放)
GroupType: 1, //组卷类型
PaperScore:0,//试卷总分数
},
//点击问题对象
ChooseItem: null,
......@@ -594,6 +613,25 @@
ComCheckIndex: -1,
savePaperLoading: false,
isShowPoint: false, //选择知识点
clickGroupItem: null, //选择的分组
}
},
computed: {
//获取计算后的问题分类(读音选择题、汉字选择题等)
newQuestionCategoryList() {
let newArray = JSON.parse(JSON.stringify(this.questionCategoryList));
if (newArray && newArray.length > 0) {
if (this.DataObj.GroupList && this.DataObj.GroupList.length > 0) {
this.DataObj.GroupList.forEach(x => {
newArray.forEach((qItem, index) => {
if (x.QuestionTypeId == qItem.Id) {
newArray.splice(index, 1);
}
})
})
}
}
return newArray;
}
},
created() {
......@@ -619,6 +657,22 @@
}
},
methods: {
GetGroupItem(gItem) {
this.clickGroupItem = gItem;
},
//添加分类
onCategoryItemClick(qObj) {
this.DataObj.GroupList.push({
GId: 0, //大题分组编号
PaperId: 0, //试卷编号
GroupName: qObj.Name,
QuestionTypeId: qObj.Id,
QuestionTypeKey: "",
GSortNum: 0,
GScore: 0, //分数
DetailsList: [], //问题列表
});
},
//关闭知识点弹窗
closeQuestionPoint() {
this.isShowPoint = false;
......@@ -840,8 +894,7 @@
}
if (qArray && qArray.length > 0) {
qArray.forEach(qItem => {
if (!this.checkGroupExists(qItem.QuestionTypeId)) {
this.DataObj.GroupList.push({
var gObj = {
GId: 0, //大题分组编号
PaperId: 0, //试卷编号
GroupName: qItem.GroupName,
......@@ -850,8 +903,12 @@
GSortNum: 0,
GScore: 0, //分数
DetailsList: [], //问题列表
});
}
//题目类型
if (!this.checkGroupExists(qItem.QuestionTypeId) && this.DataObj.GroupType == 1) {
this.DataObj.GroupList.push(gObj);
}
if (this.DataObj.GroupType == 1) {
this.DataObj.GroupList.forEach((gItem, gIndex) => {
if (gItem.QuestionTypeId == qItem.QuestionTypeId) {
if (!gItem.DetailsList) {
......@@ -860,6 +917,19 @@
gItem.DetailsList.push(qItem);
}
})
}
//题目分类
else if (this.DataObj.GroupType == 2) {
if (!this.clickGroupItem) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择左侧分类!`
})
} else {
this.clickGroupItem.DetailsList.push(qItem);
}
}
})
}
}
......@@ -940,6 +1010,7 @@
this.DataObj.PaperType = tempData.PaperType;
this.DataObj.ParentId = tempData.ParentId;
this.DataObj.IsOpen = tempData.IsOpen;
this.DataObj.GroupType = tempData.GroupType;
if (tempData.GroupList && tempData.GroupList.length > 0) {
this.DataObj.GroupList = tempData.GroupList;
}
......@@ -1025,6 +1096,7 @@
//保存题目
SavePaper() {
if (this.validateType()) {
this.DataObj.PaperScore=this.examScore;
this.savePaperLoading = true;
savePaperInfo(this.DataObj).then(res => {
this.savePaperLoading = false;
......
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