Commit 26c3b58a authored by 黄奎's avatar 黄奎

页面修改

parent 826ac2ec
......@@ -30,8 +30,9 @@
</div>
<div class="page-content">
<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"
row-key="QuestionId" selection="multiple" :selected.sync="selectedQuestion">
class="sticky-column-table sticky-header-column-table" style="max-height: 550px" separator="none"
:data="dataList" :columns="columns" row-key="QuestionId" selection="multiple"
:selected.sync="selectedQuestion">
<template v-slot:top="props">
<div class="col-2 q-table__title">问题列表</div>
<q-space />
......@@ -53,7 +54,7 @@
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="确认选择" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="saveCategory" />
@click="sureQuestion" />
</q-card-actions>
</q-card>
</q-dialog>
......@@ -80,6 +81,7 @@
QuestionTypeId: [], //题型
DifficultyType: [], //难易程度
QCategoryId: [], //分类
IsShowAllQuestion: 1, //查询所有问题字段
},
questionCategoryList: [],
questionTypeList: [], //问题类型列表
......@@ -121,11 +123,11 @@
align: 'left'
}
],
dataList:[],
pageCount:0,
selectedQuestion:[],
loading:false,
saveLoading:false
dataList: [],
pageCount: 0,
selectedQuestion: [],
loading: false,
saveLoading: false
}
},
mounted() {
......@@ -182,16 +184,18 @@
//关闭弹窗
closeSaveForm() {
this.$emit('close')
this.persistent = false
this.persistent = false;
},
saveCategory(){
//确认问题
sureQuestion() {
this.$emit('success', this.selectedQuestion)
this.persistent = false;
},
},
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
......@@ -388,7 +388,7 @@
</div>
</div>
</div>
<questionForm v-if="isShowQuestion" @close="closeQuestForm" @success="refreshPage"></questionForm>
<questionForm v-if="isShowQuestion" @close="closeQuestForm" @success="getQuestionList"></questionForm>
</div>
</div>
</template>
......@@ -452,7 +452,17 @@
PaperId: 0
},
//试卷对象
DataObj: {},
DataObj: {
PaperId: 0, //试卷编号
PaperName: '', //试卷名称
QuestionBandIds: "", //关联题库编号
DifficultyType: 1, //试卷难易程度
GenerateType: 2, //组卷类型(1-智能组卷,2-手动组卷,3-智能导入)
CreateNum: 1, //生成试卷套数
PaperType: 2, //试卷类型(1-文件夹,2-试卷)
ParentId: 0, //父节点编号,
GroupList: [], //试卷答题分类
},
//点击问题对象
ChooseItem: {},
questionDifficultyTypeList: [], //难易程度列表
......@@ -461,6 +471,7 @@
choosePointArray: [], //选择知识点
firstTypeList: [], //第一类题型
secondTypeList: [], //第二类题型
allTypeList: [], //所有题型
isShowQuestion: false,
commonIndex: -1,
examNum: 0, //题量
......@@ -477,7 +488,9 @@
this.getQuestionLevelType();
},
mounted() {
this.GetPaperInfo()
if (this.msg.PaperId && this.msg.PaperId > 0) {
this.GetPaperInfo()
}
},
methods: {
//上移下移(IsUp:0上移,1下移)
......@@ -552,6 +565,7 @@
queryQuestionTypeList({}).then(res => {
if (res.Code == 1) {
var tempArray = res.Data;
this.allTypeList = tempArray;
if (tempArray && tempArray.length > 0) {
this.firstTypeList = tempArray.slice(0, 5);
this.secondTypeList = tempArray.slice(5);
......@@ -564,23 +578,63 @@
var questionObj = this.getDetailsObj();
questionObj.QuestionTypeId = item.QId;
questionObj.QuestionTypeKey = item.Key;
questionObj.GroupName = item.Name;
var obj = CreateQuestion(item.Key);
questionObj.QuestionContentObj = obj;
if (obj) {
questionObj.QuestionContent = JSON.stringify(obj);
}
console.log("questionObj", questionObj);
var tempArray = [];
tempArray.push(questionObj);
this.AddQuestion(tempArray);
},
//添加问题
AddQuestion(qArray) {
console.log("qArray", qArray)
if (this.DataObj) {
if (!this.DataObj.GroupList) {
this.DataObj.GroupList = [];
}
if (qArray && qArray.length > 0) {
qArray.forEach(qItem => {
if (!this.checkGroupExists(qItem.QuestionTypeId)) {
this.DataObj.GroupList.push({
GId: 0, //大题分组编号
PaperId: 0, //试卷编号
GroupName: qItem.GroupName,
QuestionTypeId: qItem.QuestionTypeId,
QuestionTypeKey: qItem.QuestionTypeKey,
GSortNum: 0,
DetailsList: [], //问题列表
});
}
this.DataObj.GroupList.forEach((gItem, gIndex) => {
if (gItem.QuestionTypeId == qItem.QuestionTypeId) {
if (!gItem.DetailsList) {
gItem.DetailsList = [];
}
gItem.DetailsList.push(qItem);
}
})
})
}
}
},
//判断题库是否存在
checkGroupExists(QuestionTypeId) {
var isExistsGroup = false;
if (this.DataObj && this.DataObj.GroupList && this.DataObj.GroupList.length > 0) {
this.DataObj.GroupList.forEach((gItem, gIndex) => {
if (gItem.QuestionTypeId == item.QId) {
if (!gItem.DetailsList) {
gItem.DetailsList = [];
this.DataObj.GroupList.forEach(item => {
if (!isExistsGroup) {
if (item.QuestionTypeId == QuestionTypeId) {
isExistsGroup = true;
}
gItem.DetailsList.push(questionObj);
}
})
}
return isExistsGroup;
},
//获取试卷问题详细Obj
getDetailsObj() {
var objOption = {
Id: 0, //试卷详情编号
......@@ -597,11 +651,12 @@
IsUpdateJobExam: 0, //是否同步修改引用此题目的作业和考试(1-是)
SortNum: 0, //排序
Answer: '', //问题答案【JSON字符串】
QuestionContentObj:[],//问题选项
QuestionContentObj: [], //问题选项
IsMutex: 1, //填空题(答案顺序打乱也判正确)
Category: 0, //问题大类,
LevelType: 1, //考级程度
Score: 0, //分数
GroupName: "", //分组名称
};
return objOption;
},
......@@ -628,11 +683,28 @@
//获取题目
GetPaperInfo() {
GetPaper(this.msg).then(res => {
var tempData = res.Data;
if (res.Code == 1) {
this.DataObj = res.Data;
this.DataObj.PaperId = tempData.PaperId;
this.DataObj.PaperName = tempData.PaperName;
this.DataObj.QuestionBandIds = tempData.QuestionBandIds;
this.DataObj.DifficultyType = tempData.DifficultyType;
this.DataObj.GenerateType = tempData.GenerateType;
this.DataObj.CreateNum = tempData.CreateNum;
this.DataObj.PaperType = tempData.PaperType;
this.DataObj.ParentId = tempData.ParentId;
if (tempData.GroupList && tempData.GroupList.length > 0) {
this.DataObj.GroupList = tempData.GroupList;
}
this.calcPaper();
}
this.examScore = 0;
this.examNum = 0;
})
},
//计算试卷相关
calcPaper() {
this.examScore = 0;
this.examNum = 0;
if (this.DataObj && this.DataObj.GroupList) {
this.DataObj.GroupList.forEach(x => {
x.isShowEdit = false;
this.examNum += x.DetailsList.length;
......@@ -640,12 +712,11 @@
this.examScore += y.Score;
})
})
})
}
},
//点击问题
ClickItem(questionItem) {
this.ChooseItem = questionItem;
},
//保存题目
SavePaper() {
......@@ -656,8 +727,39 @@
closeQuestForm() {
this.isShowQuestion = false;
},
refreshPage() {
//获取选择的问题列表
getQuestionList(qArray) {
var tempArray = [];
if (qArray && qArray.length > 0) {
qArray.forEach(eItem => {
var qObj = this.getDetailsObj();
qObj.QuestionId = eItem.QuestionId;
qObj.Title = eItem.Title;
qObj.QuestionContent = eItem.QuestionContent;
qObj.DifficultyType = eItem.DifficultyType;
qObj.AnswerParse = eItem.AnswerParse;
qObj.QuestionTypeId = eItem.QuestionTypeId;
qObj.QuestionTypeKey = eItem.QuestionTypeKey;
qObj.Knowledge = eItem.Knowledge;
qObj.IsUpdateJobExam = eItem.IsUpdateJobExam;
qObj.SortNum = eItem.SortNum;
qObj.Answer = eItem.Answer;
qObj.IsMutex = eItem.IsMutex;
qObj.Category = eItem.Category;
qObj.LevelType = eItem.LevelType;
qObj.Score = eItem.Score;
var tempType = this.allTypeList.find(x => x.QId == qObj.QuestionTypeId);
if (tempType) {
qObj.GroupName = tempType.Name;
}
//问题选项
if (eItem.QuestionContent) {
qObj.QuestionContentObj = JSON.parse(eItem.QuestionContent);
}
tempArray.push(qObj);
});
}
this.AddQuestion(tempArray);
}
}
}
......
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