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

页面修改

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