|
@@ -3,12 +3,12 @@
|
|
|
<div class="create-header">
|
|
|
<p class="create-header-title">创建评测活动</p>
|
|
|
<Button class="btn-save" type="text" :loading="isLoading" ghost icon="ios-albums-outline" @click="saveEvaluation">发布评测</Button>
|
|
|
- <Button class="btn-save" type="text" :loading="isLoading" ghost icon="md-arrow-dropleft" @click="confirmToManage">返回上级</Button>
|
|
|
+ <Button class="btn-save" type="text" :loading="isLoading" ghost icon="md-arrow-back" @click="confirmToManage">返回上级</Button>
|
|
|
</div>
|
|
|
<div class="create-body">
|
|
|
<div class="evaluation-attr-wrap">
|
|
|
<p class="wrap-label">基础信息</p>
|
|
|
- <div style="width:100%; height:calc(100% - 45px);padding-top:30px;" class="dark-iview-form">
|
|
|
+ <div style="width:100%; height:calc(100% - 45px);padding-top:30px;" class="dark-iview-form ivu-select-nochoose">
|
|
|
<Form ref="evaluationInfo" :model="evaluationInfo" label-position="top" class="evaluation-attr-form " label-colon :rules="ruleValidate">
|
|
|
<FormItem label="评测名称" prop="name">
|
|
|
<Input v-model="evaluationInfo.name" placeholder="评测名称" @on-change="handlePaperName"></Input>
|
|
@@ -23,17 +23,17 @@
|
|
|
<Option v-for="(item,index) in typeList" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
- <FormItem label="测试类型" prop="type">
|
|
|
- <Select v-model="evaluationInfo.type">
|
|
|
- <Option v-for="(item,index) in typeList" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
|
+ <FormItem label="测试学段" prop="school" >
|
|
|
+ <Select v-model="evaluationInfo.school" @on-change="getPeriod">
|
|
|
+ <Option v-for="(item,index) in $store.state.schoolBaseInfo.schoolBaseInfo.period" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
-
|
|
|
- <FormItem label="施测对象">
|
|
|
- <!--<Cascader :list="list" @onClick="handleClick"></Cascader>-->
|
|
|
- <!--<Select v-model="evaluationInfo.target" multiple>
|
|
|
- <Option v-for="(item,index) in classroomList" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
- </Select>-->
|
|
|
+ <FormItem label="测试类型" prop="examType" >
|
|
|
+ <Select v-model="evaluationInfo.examType" @on-open-change="getTestType">
|
|
|
+ <Option v-for="(item,index) in testType" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="施测对象" >
|
|
|
<MultiCascader ref="addMulti" v-bind="config" @son="changeSon" hasValue :firstOpen="open" v-model="formChange.scope" @on-change="setChangeScope"></MultiCascader>
|
|
|
</FormItem>
|
|
|
<FormItem label="发布方式" prop="publish">
|
|
@@ -57,14 +57,13 @@
|
|
|
<div class="wrap-label" v-if="mode == 'school'">
|
|
|
<p>测试科目:</p>
|
|
|
<span v-for="(item,index) in evaluationInfo.paperInfo" :key="index" :class="index == currentSubjectIndex ? 'subject-item subject-item-active':'subject-item'" @click="selectSubject(index)">
|
|
|
- {{ jsFn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo, item.periodId).name}}
|
|
|
- <span style="margin:0px 5px;">·</span>
|
|
|
+ <!--{{ jsFn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo, item.periodId+1).name}}
|
|
|
+ <span style="margin:0px 5px;">·</span>-->
|
|
|
{{jsFn.getSubjectName(jsFn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo, item.periodId), item.subjectId)}}
|
|
|
<Icon type="ios-close" size="18" class="delete-subject-btn" @click="deleteSubject(index)" />
|
|
|
</span>
|
|
|
<Icon @click="addSubject" type="md-add-circle" title="添加科目" color="white" class="add-subject-icon" size="20" />
|
|
|
</div>
|
|
|
-
|
|
|
<div class="evaluation-question-main">
|
|
|
<EmptyData :top="0" style="padding-top:100px;" v-if="evaluationInfo.paperInfo.length == 0" textContent="暂无科目,请添加科目"></EmptyData>
|
|
|
<div class="create-type-wrap" v-if="evaluationInfo.paperInfo.length > 0 || mode == 'class'" >
|
|
@@ -78,7 +77,7 @@
|
|
|
</div>
|
|
|
|
|
|
|
|
|
- <Tabs v-model="activeTab" type="card" class="question-main-tabs dark-iview-tab" v-if="evaluationInfo.paperInfo.length > 0 || mode == 'class' " name="createTest">
|
|
|
+ <Tabs v-model="activeTab" type="card" class="question-main-tabs" v-if="evaluationInfo.paperInfo.length > 0 || mode == 'class' " name="createTest">
|
|
|
<!--<TabPane label="组题条件" name="auto" v-if="evaluationInfo.paperInfo[currentSubjectIndex].createType == 'auto'" :index="1" tab="createTest">
|
|
|
<AutoCreate :subjectCode="evaluationInfo.paperInfo[currentSubjectIndex].subjectCode" :periodCode="evaluationInfo.paperInfo[currentSubjectIndex].periodCode" @goToPreview="goToPreview" @autoQuestions="getAutoQuestions"></AutoCreate>
|
|
|
</TabPane>-->
|
|
@@ -102,9 +101,6 @@
|
|
|
{{examAnalysisStatus ? '试卷预览':'试卷分析'}}
|
|
|
</span>
|
|
|
</Tabs>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -113,9 +109,9 @@
|
|
|
title="添加测试学科"
|
|
|
class-name="dark-iview-modal"
|
|
|
@on-ok="confirmAddSubject"
|
|
|
+ @on-cancel="cancelAddSubject"
|
|
|
>
|
|
|
- <!--@on-cancel="cancelAddSubject"-->
|
|
|
- <div v-for="(item,index) in $store.state.schoolBaseInfo.schoolBaseInfo.period" :key="index" style="margin-top:10px;margin-bottom:30px;color:white;">
|
|
|
+ <div v-for="(item,index) in testSubject" :key="index" style="margin-bottom:10px;color:white;">
|
|
|
<div style="padding-bottom:6px;margin-bottom:6px;">
|
|
|
<span>{{item.name}}</span>
|
|
|
</div>
|
|
@@ -173,8 +169,10 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- data3: [],
|
|
|
+ selectSchool: '',
|
|
|
//isTeacher: true, //判定当前教师是否分配学校
|
|
|
+ testType: [], //测试类型
|
|
|
+ testSubject:[], //测试科目
|
|
|
startTime: '',
|
|
|
endTime:'',
|
|
|
examAnalysisStatus: false,
|
|
@@ -196,6 +194,12 @@
|
|
|
evaType: [
|
|
|
{ required: true, message: '评量模式不能为空!', trigger: 'change' }
|
|
|
],
|
|
|
+ school: [
|
|
|
+ { required: true, message: '请设置测试学段!', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ testType: [
|
|
|
+ { required: true, message: '请设置测试类型!', trigger: 'change' }
|
|
|
+ ],
|
|
|
publish: [
|
|
|
{ required: true, message: '请设置发布方式!', trigger: 'change' }
|
|
|
],
|
|
@@ -216,9 +220,11 @@
|
|
|
evaluationInfo: {
|
|
|
name: '',
|
|
|
target: [],
|
|
|
- type: '',
|
|
|
+ type: '', //测试类别
|
|
|
evaType:'',
|
|
|
publish: '',
|
|
|
+ school: '', //学段
|
|
|
+ examType:'', //测试类型
|
|
|
startTime: undefined,
|
|
|
endTime: undefined,
|
|
|
paperInfo: [],
|
|
@@ -266,7 +272,7 @@
|
|
|
clearable: true,
|
|
|
multiple: true,
|
|
|
data: [],
|
|
|
- placeholder: '请选择施測對象',
|
|
|
+ placeholder: '请选择施测对象',
|
|
|
style: "width:100%"
|
|
|
},
|
|
|
formChange: {
|
|
@@ -281,35 +287,152 @@
|
|
|
values:'gradeId',
|
|
|
label: 'name',
|
|
|
children: 'class'
|
|
|
- },
|
|
|
- //map: {
|
|
|
- // value: 'id',
|
|
|
- // values:'gradeId',
|
|
|
- // label: 'name',
|
|
|
- // children: 'class'
|
|
|
- //}
|
|
|
+ },
|
|
|
+ gradeChoose: [],
|
|
|
+ classChoose:[]
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
|
* 多選組件配置信息
|
|
|
* */
|
|
|
- setChangeScope(value) {
|
|
|
- console.log(value)
|
|
|
- //let self = this;
|
|
|
- //let data = [];
|
|
|
- //if (value) {
|
|
|
- // for (let i = 0; i < value.length; i++) {
|
|
|
- // data.push(value[i].value)
|
|
|
- // }
|
|
|
- // self.formChange.scope = data
|
|
|
- //}
|
|
|
+ async setChangeScope(data) {
|
|
|
+ console.log(data)
|
|
|
+ let classInfo = []
|
|
|
+ let periodInfo = []
|
|
|
+ let periodData = []
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ let str = (data[i].__value || "").split(',')
|
|
|
+ periodData.push(str[0])
|
|
|
+ if (data[i].grade == undefined) {
|
|
|
+ classInfo.push(data[i].value)
|
|
|
+ } else {
|
|
|
+ periodInfo.push(data[i].grade)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let datas = await this.unique(periodData)
|
|
|
+ this.gradeChoose = this.getexamGradeName(datas)
|
|
|
+ console.log(this.gradeChoose)
|
|
|
+ let dataInfo =[]
|
|
|
+ dataInfo = await this.getChooseClass(periodInfo)
|
|
|
+ if (dataInfo.length !== 0) {
|
|
|
+ this.classChoose = [...classInfo,...dataInfo]
|
|
|
+ } else {
|
|
|
+ this.classChoose = [...classInfo]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getexamGradeName(data) {
|
|
|
+ let code = []
|
|
|
+ let key = {}
|
|
|
+ for (let datas of data) {
|
|
|
+ for (let item of this.getPeriodInfo(this.evaluationInfo.school).grades) {
|
|
|
+ if (item.id = datas) {
|
|
|
+ key.id = item.id
|
|
|
+ key.name = item.name
|
|
|
+ code.push(key)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ code = this.unique(code)
|
|
|
+ return code
|
|
|
+ console.log(code)
|
|
|
},
|
|
|
changeSon() {
|
|
|
- this.open = false
|
|
|
+ this.open = true
|
|
|
+ },
|
|
|
+ //根据年级获取班级信息
|
|
|
+ getChooseClass(data) {
|
|
|
+ let classData = []
|
|
|
+ if (data.length !== 0) {
|
|
|
+ for (let item of data) {
|
|
|
+ for (let code of this.$store.state.schoolBaseInfo.classroomList) {
|
|
|
+ if (code.gradeId == item) {
|
|
|
+ classData.push(code.id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return classData
|
|
|
+ } else {
|
|
|
+ return classData
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //数组查重
|
|
|
+ unique(array) {
|
|
|
+ var res = []
|
|
|
+ for (var i = 0, len = array.length; i < len; i++) {
|
|
|
+ var current = array[i]
|
|
|
+ if (res.indexOf(current) === -1) { //查询重复值
|
|
|
+ res.push(current)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res
|
|
|
},
|
|
|
|
|
|
-
|
|
|
+ //获取选择的学段
|
|
|
+ async getPeriod(data) {
|
|
|
+ if (data !== '') {
|
|
|
+ console.log(data)
|
|
|
+ console.log(this.$store.state)
|
|
|
+ await this.getSchoolBaseInfo()
|
|
|
+ //初始化选择数据
|
|
|
+ this.testSubject = []
|
|
|
+ this.evaluationInfo.paperInfo = []
|
|
|
+ this.addSubjectBefore.length = 0
|
|
|
+ this.newAddSubjects = []
|
|
|
+ this.handelClass(data)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //判断是否存在学段信息
|
|
|
+ getTestType() {
|
|
|
+ if (this.evaluationInfo.school == '') {
|
|
|
+ this.$Message.warning('请先选择测试学段!')
|
|
|
+ } else {
|
|
|
+ if (this.getPeriodInfo(this.evaluationInfo.school).analysis !== undefined) {
|
|
|
+ this.testType = this.getPeriodInfo(this.evaluationInfo.school).analysis.type
|
|
|
+ } else {
|
|
|
+ this.$Message.warning('请先前往基础设置增加测试类型设定!')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //处理施测对象
|
|
|
+ getPeriodInfo(data) {
|
|
|
+ if (data !== '') {
|
|
|
+ let gradeInfo = this.$store.state.schoolBaseInfo.schoolBaseInfo.period
|
|
|
+ for (let item of gradeInfo) {
|
|
|
+ if (item.id == data) {
|
|
|
+ return item
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handelClass(data) {
|
|
|
+ //拼接年級和班級信息
|
|
|
+ let grade = []
|
|
|
+ let grades = []
|
|
|
+ let classData = this.$jsFn.groupBy(this.$store.state.schoolBaseInfo.classroomList, 'gradeId')
|
|
|
+ console.log(this.evaluationInfo.school)
|
|
|
+ grade = this.getPeriodInfo(this.evaluationInfo.school).grades
|
|
|
+ for (let i = 0; i < grade.length; i++) {
|
|
|
+ for (let j = 0; j < classData.length; j++) {
|
|
|
+ if (grade[i].id == classData[j][0].gradeId) {
|
|
|
+ grade[i].class = classData[j]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (grade[i].class !== undefined) {
|
|
|
+ let all = {
|
|
|
+ 'id': 'all+' + grade[i].id,
|
|
|
+ 'gradeId': grade[i].class[0].gradeId,
|
|
|
+ 'name': grade[i].name + '(全年级)'
|
|
|
+ }
|
|
|
+ grade[i].class.unshift(all)
|
|
|
+ grades.push(grade[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(grades)
|
|
|
+ this.config.data = this.convertTree(grades, this.map)
|
|
|
+ console.log('8888888888888888888888888888888')
|
|
|
+ console.log(this.config.data)
|
|
|
+ },
|
|
|
/**显示试卷分析 */
|
|
|
showAnalysis() {
|
|
|
this.examAnalysisStatus = !this.examAnalysisStatus
|
|
@@ -364,9 +487,9 @@
|
|
|
*/
|
|
|
getDate(value, flag) {
|
|
|
if (flag == 0) {
|
|
|
- this.evaluationInfo.startTime = new Date(value).getTime()/1000
|
|
|
+ this.evaluationInfo.startTime = new Date(value).getTime()
|
|
|
} else if (flag == 1) {
|
|
|
- this.evaluationInfo.endTime = new Date(value).getTime()/1000
|
|
|
+ this.evaluationInfo.endTime = new Date(value).getTime()
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
@@ -393,60 +516,14 @@
|
|
|
this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = [...questions]
|
|
|
}
|
|
|
},
|
|
|
- getSelectedQuestion(data) {
|
|
|
- this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = []
|
|
|
- this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = data.questions
|
|
|
- },
|
|
|
+ //getSelectedQuestion(data) {
|
|
|
+ // this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = []
|
|
|
+ // this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = data.questions
|
|
|
+ //},
|
|
|
goToPreview() {
|
|
|
this.activeTab = 'preview'
|
|
|
this.evaluationInfo.paperInfo[this.currentSubjectIndex].createType = 'manualPaper'
|
|
|
},
|
|
|
- deleteSubject(index) {
|
|
|
- this.deleteIndex = index
|
|
|
- this.$Modal.confirm({
|
|
|
- title: '删除科目',
|
|
|
- content: '确认删除' + this.evaluationInfo.paperInfo[index].periodName + '·' + this.evaluationInfo.paperInfo[index].subjectName + '吗?',
|
|
|
- onOk: () => {
|
|
|
- let periodIndex = -1
|
|
|
- for (let i in this.$store.state.schoolBaseInfo.schoolBaseInfo.period) {
|
|
|
- if (this.$store.state.schoolBaseInfo.schoolBaseInfo.period[i].id == this.evaluationInfo.paperInfo[index].periodCode) {
|
|
|
- periodIndex = i
|
|
|
- }
|
|
|
- }
|
|
|
- for (let i = 0; i < this.testSubjects[periodIndex].length; i++) {
|
|
|
- if (this.evaluationInfo.paperInfo[index].subjectCode == this.testSubjects[periodIndex][i]) {
|
|
|
- this.testSubjects[periodIndex].splice(i, 1)
|
|
|
- }
|
|
|
- }
|
|
|
- this.evaluationInfo.paperInfo.splice(this.deleteIndex, 1)
|
|
|
- this.currentSubjectIndex = 0
|
|
|
- this.deleteIndex = -1
|
|
|
- this.$Message.success('删除成功!')
|
|
|
- },
|
|
|
- onCancel: () => {
|
|
|
- this.deleteIndex = -1
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- newAddSubject(index, i, code) {
|
|
|
- if (!this.checkIsDisabled(index, code)) {
|
|
|
- let flag = true
|
|
|
- for (let j = 0; j < this.newAddSubjects.length; j++) {
|
|
|
- if (this.newAddSubjects[j].index == index && this.newAddSubjects[j].i == i) {
|
|
|
- flag = false
|
|
|
- this.newAddSubjects.splice(j, 1)
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- if (flag) {
|
|
|
- this.newAddSubjects.push({
|
|
|
- index, code,i
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- alert('disabled')
|
|
|
- }
|
|
|
- },
|
|
|
checkIsDisabled(index, code) {
|
|
|
if (this.addSubjectBefore[index] !== undefined) {
|
|
|
return this.addSubjectBefore[index].indexOf(code) !== -1
|
|
@@ -479,6 +556,39 @@
|
|
|
// this.evaluationInfo.paperInfo.length = 0
|
|
|
// }
|
|
|
//},
|
|
|
+ deleteSubject(index) {
|
|
|
+ console.log(index)
|
|
|
+ this.deleteIndex = index
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: '删除科目',
|
|
|
+ content: '确认删除' + this.evaluationInfo.paperInfo[index].subjectName + '吗?',
|
|
|
+ onOk: () => {
|
|
|
+ if (this.deleteIndex !== undefined) {
|
|
|
+ this.testSubjects[0].splice(this.deleteIndex, 1)
|
|
|
+ this.evaluationInfo.paperInfo.splice(this.deleteIndex, 1)
|
|
|
+ this.currentSubjectIndex = 0
|
|
|
+ this.deleteIndex = -1
|
|
|
+ this.$Message.success('删除成功!')
|
|
|
+ }
|
|
|
+ //let periodIndex = -1
|
|
|
+ //for (let i in this.$store.state.schoolBaseInfo.schoolBaseInfo.period) {
|
|
|
+ // if (this.$store.state.schoolBaseInfo.schoolBaseInfo.period[i].id == this.evaluationInfo.paperInfo[index].periodCode) {
|
|
|
+ // periodIndex = i
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //for (let i = 0; i < this.testSubjects.length; i++) {
|
|
|
+ // if (this.evaluationInfo.paperInfo[index].subjectCode == this.testSubjects[i]) {
|
|
|
+ // console.log(i)
|
|
|
+ // this.testSubjects.splice(i, 1)
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ },
|
|
|
+ onCancel: () => {
|
|
|
+ this.deleteIndex = -1
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
confirmAddSubject() {
|
|
|
let data = {
|
|
|
pk: 'Exam',
|
|
@@ -502,22 +612,44 @@
|
|
|
scope: this.mode,
|
|
|
create: Math.round(new Date() / 1000)
|
|
|
}
|
|
|
+ console.log(this.newAddSubjects.length)
|
|
|
for (let item of this.newAddSubjects) {
|
|
|
+ let periodData = this.getPeriodInfo(this.evaluationInfo.school)
|
|
|
this.evaluationInfo.paperInfo.push({
|
|
|
- periodName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].name,
|
|
|
- periodId: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].id,
|
|
|
- subjectName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].name,
|
|
|
- subjectId: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].id,
|
|
|
+ periodName: periodData.name,
|
|
|
+ periodId: periodData.id,
|
|
|
+ subjectName: periodData.subjects[item.i].name,
|
|
|
+ subjectId: periodData.subjects[item.i].id,
|
|
|
createType: 'manualPaper',
|
|
|
score: 100,
|
|
|
item: [],
|
|
|
filter: {},
|
|
|
- name: this.evaluationInfo.name + '--' + this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].name
|
|
|
+ name: this.evaluationInfo.name + '--' +periodData.subjects[item.i].name
|
|
|
})
|
|
|
}
|
|
|
+ console.log(this.evaluationInfo)
|
|
|
this.newAddSubjects.length = 0
|
|
|
this.addSubjectBefore.length = 0
|
|
|
},
|
|
|
+ newAddSubject(index, i, code) {
|
|
|
+ if (!this.checkIsDisabled(index, code)) {
|
|
|
+ let flag = true
|
|
|
+ for (let j = 0; j < this.newAddSubjects.length; j++) {
|
|
|
+ if (this.newAddSubjects[j].index == index && this.newAddSubjects[j].i == i) {
|
|
|
+ flag = false
|
|
|
+ this.newAddSubjects.splice(j, 1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag) {
|
|
|
+ this.newAddSubjects.push({
|
|
|
+ index, code, i
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ alert('disabled')
|
|
|
+ }
|
|
|
+ },
|
|
|
cancelAddSubject() {
|
|
|
this.addSubjectBefore = [...this.testSubjects]
|
|
|
},
|
|
@@ -525,6 +657,7 @@
|
|
|
getSchoolBaseInfo() {
|
|
|
this.$store.dispatch('schoolBaseInfo/getSchoolBaseData').then(
|
|
|
(res) => {
|
|
|
+ console.log(this.$store.state)
|
|
|
if (res.code == 2) {
|
|
|
alert('数据为空!')
|
|
|
}
|
|
@@ -537,42 +670,12 @@
|
|
|
(res) => {
|
|
|
if (res.code == 2) {
|
|
|
alert('数据为空!')
|
|
|
- } else {
|
|
|
- //拼接年級和班級信息
|
|
|
- let grade = []
|
|
|
- let grades = []
|
|
|
-
|
|
|
- let classData = this.$jsFn.groupBy(res.data, 'gradeId')
|
|
|
- for (let item of this.$store.state.schoolBaseInfo.schoolBaseInfo.period) {
|
|
|
- grade.push(...item.grades)
|
|
|
- }
|
|
|
-
|
|
|
- for (let i = 0; i < grade.length; i++) {
|
|
|
- for (let j = 0; j < classData.length; j++) {
|
|
|
- if (grade[i].id == classData[j][0].gradeId) {
|
|
|
- grade[i].class = classData[j]
|
|
|
- }
|
|
|
- }
|
|
|
- if (grade[i].class !== undefined) {
|
|
|
- let all = {
|
|
|
- 'id': 'all-' + grade[i].id,
|
|
|
- 'gradeId': grade[i].class[0].gradeId,
|
|
|
- 'name': grade[i].name + '(全年级)'
|
|
|
- }
|
|
|
- grade[i].class.unshift(all)
|
|
|
- grades.push(grade[i])
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.config.data = this.convertTree(grades, this.map)
|
|
|
- console.log(this.config.data)
|
|
|
- }
|
|
|
+ }
|
|
|
},
|
|
|
(err) => {
|
|
|
this.$Message.error('API error!')
|
|
|
}
|
|
|
)
|
|
|
- console.log(this.$store.state)
|
|
|
},
|
|
|
/**
|
|
|
* 查找教师课程下的班级
|
|
@@ -699,29 +802,50 @@
|
|
|
saveEvaluation() {
|
|
|
console.log('最後數據')
|
|
|
console.log(this.evaluationInfo)
|
|
|
+
|
|
|
let data = {
|
|
|
pk: 'Exam',
|
|
|
- code: "Exam-" + this.$store.state.userInfo.schoolCode,
|
|
|
+ code: this.$store.state.userInfo.schoolCode,
|
|
|
school: this.$store.state.userInfo.schoolCode,
|
|
|
- id: this.$jsFn.uuid(),
|
|
|
name: this.evaluationInfo.name,
|
|
|
creatorId: this.$store.state.userInfo.TEAMModelId,
|
|
|
- type: "union",
|
|
|
- period: {},
|
|
|
- grades: [],
|
|
|
- subjects: [],
|
|
|
- examType: {},
|
|
|
+ type: this.evaluationInfo.type,
|
|
|
+ period: {
|
|
|
+ id: this.getPeriodInfo(this.evaluationInfo.school).id,
|
|
|
+ name: this.getPeriodInfo(this.evaluationInfo.school).name
|
|
|
+ },
|
|
|
+ grades: this.gradeChoose,
|
|
|
+ subjects: this.getPaperInfo(this.evaluationInfo.papers, this.evaluationInfo.paperInfo).subject,
|
|
|
+ papers: this.getPaperInfo(this.evaluationInfo.papers, this.evaluationInfo.paperInfo).paper,
|
|
|
+ examType: {
|
|
|
+ id: this.evaluationInfo.examType,
|
|
|
+ name: this.getexamTypeName(this.evaluationInfo.examType)
|
|
|
+ },
|
|
|
year: new Date().getFullYear(),
|
|
|
range: this.mode,
|
|
|
source: this.evaluationInfo.evaType,
|
|
|
- targetClasseIds: [],
|
|
|
- startTime: this.evaluationInfo.startTime,
|
|
|
+ targetClassIds: this.classChoose,
|
|
|
+ startTime: Math.round(new Date()),
|
|
|
endTime: this.evaluationInfo.endTime,
|
|
|
progress: 'going',
|
|
|
scope: this.mode,
|
|
|
- create: Math.round(new Date() / 1000)
|
|
|
+ createDate: Math.round(new Date())
|
|
|
}
|
|
|
console.log(data)
|
|
|
+ this.$api.learnActivity.SaveExamInfo(data).then(
|
|
|
+ res => {
|
|
|
+ if (res.error == null) {
|
|
|
+ console.log(res)
|
|
|
+ this.$Message.success('评测发布成功!')
|
|
|
+ this.evaluationInfo.papers = res.exam
|
|
|
+ } else {
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
+ }
|
|
|
+ )
|
|
|
//if (this.checkData()) {
|
|
|
// this.handleData()
|
|
|
|
|
@@ -729,10 +853,55 @@
|
|
|
// this.$Message.error('请完善基础信息,再保存!')
|
|
|
//}
|
|
|
},
|
|
|
- addSubject() {
|
|
|
- [...this.addSubjectBefore] = this.testSubjects
|
|
|
- this.addSubjectStatus = true
|
|
|
+ getexamTypeName(data) {
|
|
|
+ let key = ''
|
|
|
+ for (let item of this.getPeriodInfo(this.evaluationInfo.school).analysis.type) {
|
|
|
+ if (item.id = data) {
|
|
|
+ key = item.name
|
|
|
+ return key
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getPaperInfo(data,rule) {
|
|
|
+ if (data.length !== 0) {
|
|
|
+ let info = {
|
|
|
+ subject: [],
|
|
|
+ paper: []
|
|
|
+ }
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ let sub = {}
|
|
|
+ let paper = {}
|
|
|
+ sub.id = data[i].subjectId
|
|
|
+ sub.name = data[i].subjectName
|
|
|
+ paper.id = data[i].id
|
|
|
+ paper.code = data[i].code
|
|
|
+ paper.name = data[i].name
|
|
|
+ paper.blob = data[i].blob
|
|
|
+ paper.scope = data[i].scope
|
|
|
+ paper.multipleRule = rule[i].multipleRule
|
|
|
+ paper.answers = []
|
|
|
+ paper.point = []
|
|
|
+ for (let k = 0; k < data[i].scoring.length; k++) {
|
|
|
+ paper.answers.push(data[i].scoring[k].ans)
|
|
|
+ paper.point.push(data[i].scoring[k].score)
|
|
|
+ }
|
|
|
+ info.subject.push(sub)
|
|
|
+ info.paper.push(paper)
|
|
|
+
|
|
|
+ }
|
|
|
+ return info
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
+ addSubject() {
|
|
|
+ if (this.evaluationInfo.school !== '') {
|
|
|
+ this.testSubject.length = []
|
|
|
+ this.testSubject.push(this.getPeriodInfo(this.evaluationInfo.school))
|
|
|
+ this.addSubjectBefore = [...this.testSubjects]
|
|
|
+ this.addSubjectStatus = true
|
|
|
+ } else {
|
|
|
+ this.$Message.warning('请先选择测试学段!')
|
|
|
+ }
|
|
|
},
|
|
|
//处理树结构数据
|
|
|
convertTree(tree, map) {
|
|
@@ -749,6 +918,7 @@
|
|
|
}
|
|
|
if (children !== undefined) {
|
|
|
children.map(item => {
|
|
|
+ console.log(item)
|
|
|
item['type'] = 'class'
|
|
|
item = delete item.children
|
|
|
})
|
|
@@ -759,11 +929,13 @@
|
|
|
children
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
return result
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
let routerData = this.$route.params.evaluationInfo
|
|
|
+ console.log(routerData)
|
|
|
if (routerData !== undefined) {
|
|
|
this.startTime = new Date(routerData.startTime)
|
|
|
this.endTime = new Date(routerData.endTime)
|
|
@@ -771,7 +943,6 @@
|
|
|
routerData.paperInfo[i].createType = 'manualPaper'
|
|
|
}
|
|
|
this.evaluationInfo = routerData
|
|
|
-
|
|
|
/**
|
|
|
处理无接口数据时返回为个人课程或校本课程
|
|
|
*/
|
|
@@ -786,10 +957,18 @@
|
|
|
this.findClassroom()
|
|
|
},
|
|
|
mounted() {
|
|
|
+ console.log(this.$store)
|
|
|
this.mode = this.$route.query.type
|
|
|
+ this.getSchoolBaseInfo()
|
|
|
if (this.mode == 'class') {
|
|
|
this.getClassType()
|
|
|
}
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ evaluationInfo() {
|
|
|
+ deep:true
|
|
|
+ console.log('88888888888')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|