|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="create-evaluation-container">
|
|
|
<div class="create-header">
|
|
|
- <p class="create-header-title">创建评测活动</p>
|
|
|
+ <p class="create-header-title" @click="consData">创建评测活动</p>
|
|
|
<Button class="btn-save" type="text" :loading="isLoading" ghost icon="ios-albums-outline" @click="saveEvaluation">发布评测</Button>
|
|
|
<Button class="btn-save" type="text" ghost icon="md-arrow-back" @click="confirmToManage">返回上级</Button>
|
|
|
</div>
|
|
@@ -10,14 +10,14 @@
|
|
|
<p class="wrap-label">基础信息</p>
|
|
|
<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="school">
|
|
|
- <Select v-model="evaluationInfo.school" @on-change="getPeriod">
|
|
|
- <Option v-for="(item,index) in $store.state.user.schoolProfile.periods" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
<FormItem label="评测名称" prop="name">
|
|
|
<Input v-model="evaluationInfo.name" placeholder="评测名称" @on-change="handlePaperName"></Input>
|
|
|
</FormItem>
|
|
|
+ <FormItem label="测试学段" prop="period.id">
|
|
|
+ <Select v-model="evaluationInfo.period.id" @on-change="setPeriodName" label-in-value>
|
|
|
+ <Option v-for="(item,index) in $store.state.user.schoolProfile.periods" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
<FormItem label="评量模式" prop="evaType">
|
|
|
<Select v-model="evaluationInfo.evaType">
|
|
|
<Option v-for="(item,index) in evaType" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
@@ -29,13 +29,15 @@
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
<FormItem label="测试类型" prop="examType">
|
|
|
- <Select v-model="evaluationInfo.examType" @on-open-change="getTestType">
|
|
|
+ <Select v-model="evaluationInfo.examType.id" @on-change="setExamTypeName" label-in-value>
|
|
|
<Option v-for="(item,index) in testType" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
<FormItem label="施测对象">
|
|
|
- <select-tree v-model="queryVal" multiple :treeData="selectData" @on-select-change="selectChange"></select-tree>
|
|
|
- <!--<MultiCascader ref="addMulti" v-bind="config" @son="changeSon" hasValue :firstOpen="open" v-model="formChange.scope" @on-change="setChangeScope"></MultiCascader>-->
|
|
|
+ <!--<select-tree v-model="queryVal" multiple :treeData="selectData" @on-select-change="selectChange"></select-tree>-->
|
|
|
+ <el-cascader size="small" clearable filterable v-model="queryVal" :options="curGrades" :props="props" @change="treeChange" collapse-tags placeholder="请先选择学段" style="width:100%;">
|
|
|
+ <p slot="empty">暂无数据</p>
|
|
|
+ </el-cascader>
|
|
|
</FormItem>
|
|
|
<FormItem label="发布方式" prop="publish">
|
|
|
<RadioGroup v-model="evaluationInfo.publish" style="color:white;">
|
|
@@ -58,7 +60,7 @@
|
|
|
<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.getSubjectName(jsFn.getPeriod( $store.state.user.schoolProfile.school_base, item.periodId), item.subjectId)}}
|
|
|
+ {{item.subjectName}}
|
|
|
<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" />
|
|
@@ -106,20 +108,13 @@
|
|
|
title="添加测试学科"
|
|
|
class-name="dark-iview-modal"
|
|
|
@on-ok="confirmAddSubject"
|
|
|
- @on-cancel="cancelAddSubject"
|
|
|
>
|
|
|
- <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>
|
|
|
- <CheckboxGroup v-model="testSubjects[index]">
|
|
|
- <Checkbox v-for="(subjectItem,indexs) in item.subjects" :key="indexs" :label="subjectItem.id" :disabled="checkIsDisabled(index,subjectItem.id)" @input="newAddSubject(index,indexs,subjectItem.id)">
|
|
|
+ <CheckboxGroup v-model="evaluationInfo.subjectIds" style="color:white;" @on-change="setSubjectName">
|
|
|
+ <Checkbox v-for="(subjectItem,index) in curSubjects" :key="index" :label="subjectItem.id" >
|
|
|
<span>{{subjectItem.name}}</span>
|
|
|
</Checkbox>
|
|
|
</CheckboxGroup>
|
|
|
- </div>
|
|
|
</Modal>
|
|
|
-
|
|
|
<Modal v-model="goToManageStatus"
|
|
|
title="管理评测"
|
|
|
:mask-closable="false"
|
|
@@ -128,13 +123,6 @@
|
|
|
@on-ok="confirmToManage">
|
|
|
<p>评测保存成功,是否跳转到管理评测页面查看?</p>
|
|
|
</Modal>
|
|
|
- <!--<Modal v-model="comfirmPreviewStatus"
|
|
|
- ok-text="是"
|
|
|
- cancel-text="否"
|
|
|
- :mask-closable="false"
|
|
|
- @on-ok="goToPreview">
|
|
|
- <p style="font-size:18px;padding-top:15px;">自动组题成功,是否跳转到试题预览界面预览题目?</p>
|
|
|
- </Modal>-->
|
|
|
<Modal v-model="confirmPaperStatus"
|
|
|
title="挑选试卷"
|
|
|
ok-text="是"
|
|
@@ -153,9 +141,6 @@
|
|
|
import ImportCreate from './ImportCreate.vue'
|
|
|
import TeacherPreview from './TeacherPreview.vue'
|
|
|
import StudentPreview from './StudentPreview.vue'
|
|
|
- import jsFn from '@/utils/js-fn.js'
|
|
|
- import router from '../../router'
|
|
|
- import { json } from 'd3'
|
|
|
export default {
|
|
|
components: {
|
|
|
AutoCreate,
|
|
@@ -168,33 +153,86 @@
|
|
|
SelectTree
|
|
|
},
|
|
|
data() {
|
|
|
+ const _this = this
|
|
|
return {
|
|
|
- selectSchool: '',
|
|
|
- //isTeacher: true, //判定当前教师是否分配学校
|
|
|
- testType: [], //测试类型
|
|
|
- testSubject: [], //测试科目
|
|
|
+ props: {
|
|
|
+ multiple: true,
|
|
|
+ value: 'id',
|
|
|
+ label: 'name',
|
|
|
+ lazy: true,
|
|
|
+ //动态获取当前年级下面的班级数据
|
|
|
+ lazyLoad: function (node, resolve) {
|
|
|
+ console.log('node', node)
|
|
|
+ let level = -1
|
|
|
+ if (node) {
|
|
|
+ level = node.level
|
|
|
+ }
|
|
|
+ switch (level) {
|
|
|
+ case 0:
|
|
|
+ if (_this.evaluationInfo.period) {
|
|
|
+ _this.$store.dispatch('user/getSchoolProfile').then(
|
|
|
+ res => {
|
|
|
+ let f = res.school_base.period.filter((item) => {
|
|
|
+ return item.id == _this.evaluationInfo.period
|
|
|
+ })
|
|
|
+ if (f.length > 0) {
|
|
|
+ resolve(f[0].grades)
|
|
|
+ } else {
|
|
|
+ resolve([])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ resolve([])
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 1:
|
|
|
+ _this.$store.dispatch('user/getSchoolProfile').then(
|
|
|
+ res => {
|
|
|
+ let f = res.school_classes.filter((item) => {
|
|
|
+ return item.gradeId == node.data.id
|
|
|
+ })
|
|
|
+ f.forEach(item => {
|
|
|
+ item.leaf = true
|
|
|
+ })
|
|
|
+ resolve(f)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ break
|
|
|
+ case 2:
|
|
|
+ resolve([])
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ schoolBase: {
|
|
|
+ period:[]
|
|
|
+ },
|
|
|
startTime: '',
|
|
|
- endTime: '',
|
|
|
+ endTime:'',
|
|
|
+ classroomList: [],
|
|
|
examAnalysisStatus: false,
|
|
|
confirmPaperStatus: false,
|
|
|
- selectedPaper: {},
|
|
|
- selectedPaperInfo: {},
|
|
|
- jsFn,
|
|
|
- isLoading: false,
|
|
|
comfirmPreviewStatus: false,
|
|
|
goToManageStatus: false,
|
|
|
+ addSubjectStatus: false,
|
|
|
+ isLoading: false,
|
|
|
+ selectedPaper: {},
|
|
|
+ selectedPaperInfo: {},
|
|
|
examInfo: {},
|
|
|
ruleValidate: {
|
|
|
name: [
|
|
|
{ required: true, message: '评测名称不能为空!', trigger: 'change' }
|
|
|
],
|
|
|
- type: [
|
|
|
+ 'type.id': [
|
|
|
{ required: true, message: '测试类型不能为空!', trigger: 'change' }
|
|
|
],
|
|
|
evaType: [
|
|
|
{ required: true, message: '评量模式不能为空!', trigger: 'change' }
|
|
|
],
|
|
|
- school: [
|
|
|
+ 'period.id': [
|
|
|
{ required: true, message: '请设置测试学段!', trigger: 'change' }
|
|
|
],
|
|
|
testType: [
|
|
@@ -211,26 +249,24 @@
|
|
|
]
|
|
|
},
|
|
|
deleteIndex: -1,
|
|
|
- testSubjects: [],
|
|
|
activeTab: 'manualPaper',
|
|
|
- addSubjectStatus: false,
|
|
|
- addSubjectBefore: [],
|
|
|
- newAddSubjects: [],
|
|
|
currentSubjectIndex: 0,
|
|
|
evaluationInfo: {
|
|
|
name: '',
|
|
|
- target: [],
|
|
|
+ targetClassIds: [],
|
|
|
+ grades:[],
|
|
|
type: '', //测试类别
|
|
|
evaType: '',
|
|
|
publish: '0',
|
|
|
- school: '', //学段
|
|
|
- examType: '', //测试类型
|
|
|
+ subjects:[],
|
|
|
+ subjectIds:[],
|
|
|
+ period: {}, //学段
|
|
|
+ examType: {}, //测试类型
|
|
|
startTime: undefined,
|
|
|
endTime: undefined,
|
|
|
paperInfo: [],
|
|
|
papers: []
|
|
|
},
|
|
|
- classroomList: [],
|
|
|
typeList: [
|
|
|
{
|
|
|
value: 'regular',
|
|
@@ -266,179 +302,41 @@
|
|
|
}
|
|
|
],
|
|
|
mode: '',
|
|
|
- selectData:[],
|
|
|
- queryVal:"",
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- config: {
|
|
|
- clearable: true,
|
|
|
- multiple: true,
|
|
|
- data: [],
|
|
|
- placeholder: '请选择施测对象',
|
|
|
- style: "width:100%"
|
|
|
- },
|
|
|
- formChange: {
|
|
|
- id: '',
|
|
|
- status: false,
|
|
|
- scope: [],
|
|
|
- end_date: ''
|
|
|
- },
|
|
|
- open: false,
|
|
|
-
|
|
|
-
|
|
|
- map: {
|
|
|
- value: 'id',
|
|
|
- values: 'gradeId',
|
|
|
- label: 'name',
|
|
|
- children: 'class'
|
|
|
- },
|
|
|
- gradeChoose: [],
|
|
|
- classChoose: []
|
|
|
+ queryVal: "",
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- //获取筛选的班级信息
|
|
|
- selectChange(multipleShowVal) {
|
|
|
- if (multipleShowVal.length) {
|
|
|
- let gradeData = []
|
|
|
- for (let item of multipleShowVal) {
|
|
|
- for (let items of this.$store.state.user.schoolProfile.school_classes) {
|
|
|
- if (item == items.id) {
|
|
|
- gradeData.push(items.gradeId)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(gradeData)
|
|
|
- console.log(multipleShowVal)
|
|
|
- let data = this.unique(gradeData)
|
|
|
- console.log(data)
|
|
|
- this.gradeChoose = this.getexamGradeName(data)
|
|
|
- this.classChoose = multipleShowVal
|
|
|
- console.log('选择的班级和年级')
|
|
|
- console.log(this.gradeChoose)
|
|
|
- console.log(this.classChoose)
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * 多選組件配置信息
|
|
|
- * */
|
|
|
- //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)
|
|
|
- // let dataInfo = []
|
|
|
- // dataInfo = await this.getChooseClass(periodInfo)
|
|
|
- // if (dataInfo.length !== 0) {
|
|
|
- // this.classChoose = [...classInfo, ...dataInfo]
|
|
|
- // } else {
|
|
|
- // this.classChoose = [...classInfo]
|
|
|
- // }
|
|
|
- //},
|
|
|
- getexamGradeName(data) {
|
|
|
- let code = []
|
|
|
- for (let datas of data) {
|
|
|
- for (let item of this.getPeriodInfo(this.evaluationInfo.school).grades) {
|
|
|
- if (datas == item.id ) {
|
|
|
- code.push(item)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return code
|
|
|
- },
|
|
|
- changeSon() {
|
|
|
- this.open = true
|
|
|
- },
|
|
|
- //根据年级获取班级信息
|
|
|
- //getChooseClass(data) {
|
|
|
- // let classData = []
|
|
|
- // if (data.length !== 0) {
|
|
|
- // for (let item of data) {
|
|
|
- // for (let code of this.$store.state.user.schoolProfile.school_classes) {
|
|
|
- // 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
|
|
|
+ //设置学科名称
|
|
|
+ setSubjectName(data) {
|
|
|
+ this.evaluationInfo.subjects = this.curSubjects.filter(item => {
|
|
|
+ return this.evaluationInfo.subjectIds.indexOf(item.id) >= 0
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
- //获取选择的学段
|
|
|
- async getPeriod(data) {
|
|
|
- if (data !== '') {
|
|
|
- //初始化选择数据
|
|
|
- this.testSubject = []
|
|
|
- this.evaluationInfo.paperInfo = []
|
|
|
- this.addSubjectBefore.length = 0
|
|
|
- this.newAddSubjects = []
|
|
|
- this.handelClass(data)
|
|
|
- }
|
|
|
+ //设置考试类型名称
|
|
|
+ setExamTypeName(data) {
|
|
|
+ console.log(data)
|
|
|
+ this.evaluationInfo.examType.name = data.label
|
|
|
},
|
|
|
- //判断是否存在学段信息
|
|
|
- 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('请先前往基础设置增加测试类型设定!')
|
|
|
- }
|
|
|
- }
|
|
|
+ //设置学段名称
|
|
|
+ setPeriodName(data) {
|
|
|
+ this.evaluationInfo.period.name = data.label
|
|
|
},
|
|
|
- //处理施测对象
|
|
|
- getPeriodInfo(data) {
|
|
|
- console.log(data)
|
|
|
- if (data !== '') {
|
|
|
- let gradeInfo = JSON.parse(JSON.stringify(this.$store.state.user.schoolProfile.school_base.period))
|
|
|
- for (let item of gradeInfo) {
|
|
|
- if (item.id == data) {
|
|
|
- return item
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ consData() {
|
|
|
+ console.log('evaluationInfo',this.evaluationInfo)
|
|
|
},
|
|
|
- handelClass(data) {
|
|
|
- //拼接年級和班級信息
|
|
|
- let grade = []
|
|
|
- this.selectData.length = 0
|
|
|
- let classData = []
|
|
|
- classData = this.$jsFn.groupBy(this.$store.state.user.schoolProfile.school_classes, 'gradeId')
|
|
|
- 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 && classData[j][0] !== undefined) {
|
|
|
- grade[i].class = classData[j]
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- this.selectData = this.convertTree(grade, this.map)
|
|
|
+ treeChange(data) {
|
|
|
+ //获取classIds
|
|
|
+ this.evaluationInfo.targetClassIds = data.map(item => {
|
|
|
+ return item[1]
|
|
|
+ })
|
|
|
+ //获取年级对象
|
|
|
+ let graIds = new Set(data.map(item => {
|
|
|
+ return item[0]
|
|
|
+ }))
|
|
|
+ graIds = Array.from(graIds)
|
|
|
+ this.evaluationInfo.grades = this.curGrades.filter(item => {
|
|
|
+ return graIds.indexOf(item.id) >= 0
|
|
|
+ })
|
|
|
},
|
|
|
/**显示试卷分析 */
|
|
|
showAnalysis() {
|
|
@@ -474,8 +372,6 @@
|
|
|
this.confirmPaperStatus = true
|
|
|
},
|
|
|
comfirmSelectPaper() {
|
|
|
- //this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = [...this.selectedPaper.item]
|
|
|
- //this.evaluationInfo.paperInfo[this.currentSubjectIndex].markConfig = this.selectedPaper.markConfig
|
|
|
this.evaluationInfo.paperInfo[this.currentSubjectIndex] = JSON.parse(JSON.stringify(this.selectedPaper))
|
|
|
this.evaluationInfo.papers[this.currentSubjectIndex] = JSON.parse(JSON.stringify(this.selectedPaperInfo))
|
|
|
this.evaluationInfo.paperInfo[this.currentSubjectIndex].id = undefined
|
|
@@ -494,19 +390,6 @@
|
|
|
this.evaluationInfo.endTime = new Date(value).getTime()
|
|
|
}
|
|
|
},
|
|
|
- /**
|
|
|
- * 获取自动组题结果
|
|
|
- * @param questions
|
|
|
- */
|
|
|
- //getAutoQuestions(questions) {
|
|
|
- // if (this.evaluationInfo.paperInfo[this.currentSubjectIndex].item != undefined) {
|
|
|
- // this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = [...questions, ...this.evaluationInfo.paperInfo[this.currentSubjectIndex].item]
|
|
|
- // } else {
|
|
|
- // this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = [...questions]
|
|
|
- // }
|
|
|
- // //this.comfirmPreviewStatus = true//自动跳转到预览页面,无需手动确认
|
|
|
- // this.goToPreview()//自动跳转
|
|
|
- //},
|
|
|
/**
|
|
|
* 获取导入试卷题目
|
|
|
* @param questions
|
|
@@ -518,20 +401,12 @@
|
|
|
this.evaluationInfo.paperInfo[this.currentSubjectIndex].item = [...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'
|
|
|
},
|
|
|
- checkIsDisabled(index, code) {
|
|
|
- if (this.addSubjectBefore[index] !== undefined) {
|
|
|
- return this.addSubjectBefore[index].indexOf(code) !== -1
|
|
|
- } else {
|
|
|
- return false
|
|
|
- }
|
|
|
+ checkIsDisabled(code) {
|
|
|
+ return this.evaluationInfo.subjectIds.indexOf(code) !== -1
|
|
|
},
|
|
|
inDevelopment() {
|
|
|
this.$Message.info('功能正在开发中,敬请期待!')
|
|
@@ -539,25 +414,6 @@
|
|
|
setActiveTab(data) {
|
|
|
this.activeTab = data
|
|
|
},
|
|
|
- //getClassType() {
|
|
|
- // if (this.evaluationInfo.paperInfo.length == 0) {
|
|
|
- // this.evaluationInfo.paperInfo.push({
|
|
|
- // periodName: '默认学段',
|
|
|
- // periodCode: '80650390',
|
|
|
- // subjectName: '默认学科',
|
|
|
- // subjectCode: '80650390',
|
|
|
- // createType: 'manualPaper',
|
|
|
- // score: 100,
|
|
|
- // item: [],
|
|
|
- // filter: {},
|
|
|
- // name: this.evaluationInfo.name
|
|
|
- // })
|
|
|
- // this.newAddSubjects.length = 0
|
|
|
- // this.addSubjectBefore.length = 0
|
|
|
- // } else {
|
|
|
- // this.evaluationInfo.paperInfo.length = 0
|
|
|
- // }
|
|
|
- //},
|
|
|
deleteSubject(index) {
|
|
|
this.deleteIndex = index
|
|
|
this.$Modal.confirm({
|
|
@@ -565,25 +421,13 @@
|
|
|
content: '确认删除' + this.evaluationInfo.paperInfo[index].subjectName + '吗?',
|
|
|
onOk: () => {
|
|
|
if (this.deleteIndex !== undefined) {
|
|
|
- this.testSubjects[0].splice(this.deleteIndex, 1)
|
|
|
+ this.evaluationInfo.subjects.splice(this.deleteIndex, 1)
|
|
|
+ this.evaluationInfo.subjectIds.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
|
|
@@ -591,69 +435,23 @@
|
|
|
})
|
|
|
},
|
|
|
confirmAddSubject() {
|
|
|
- for (let item of this.newAddSubjects) {
|
|
|
- let periodData = this.getPeriodInfo(this.evaluationInfo.school)
|
|
|
+ for (let item of this.evaluationInfo.subjects) {
|
|
|
+ let periodData = this.schoolBase.period.filter((item)=> {
|
|
|
+ return item.id == this.evaluationInfo.period.id
|
|
|
+ })
|
|
|
this.evaluationInfo.paperInfo.push({
|
|
|
periodName: periodData.name,
|
|
|
periodId: periodData.id,
|
|
|
- subjectName: periodData.subjects[item.i].name,
|
|
|
- subjectId: periodData.subjects[item.i].id,
|
|
|
+ subjectName: item.name,
|
|
|
+ subjectId: item.id,
|
|
|
createType: 'manualPaper',
|
|
|
score: 100,
|
|
|
item: [],
|
|
|
filter: {},
|
|
|
- name: this.evaluationInfo.name + '--' + periodData.subjects[item.i].name
|
|
|
+ name: this.evaluationInfo.name + '--' + item.name
|
|
|
})
|
|
|
}
|
|
|
- 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]
|
|
|
- },
|
|
|
- //获取学校基本信息
|
|
|
- //getSchoolBaseInfo() {
|
|
|
- // this.$store.dispatch('schoolBaseInfo/getSchoolBaseData').then(
|
|
|
- // (res) => {
|
|
|
- // console.log(this.$store.state)
|
|
|
- // if (res.code == 2) {
|
|
|
- // alert('数据为空!')
|
|
|
- // }
|
|
|
- // },
|
|
|
- // (err) => {
|
|
|
- // this.$Message.error('API error!')
|
|
|
- // }
|
|
|
- // )
|
|
|
- // this.$store.dispatch('schoolBaseInfo/getClassroom').then(
|
|
|
- // (res) => {
|
|
|
- // if (res.code == 2) {
|
|
|
- // alert('数据为空!')
|
|
|
- // }
|
|
|
- // },
|
|
|
- // (err) => {
|
|
|
- // this.$Message.error('API error!')
|
|
|
- // }
|
|
|
- // )
|
|
|
- //},
|
|
|
/**
|
|
|
* 查找教师课程下的班级
|
|
|
* */
|
|
@@ -747,21 +545,10 @@
|
|
|
* @param index
|
|
|
*/
|
|
|
saveTestPaper(paperInfo, index) {
|
|
|
-
|
|
|
if (this.examInfo.id == undefined) {
|
|
|
this.isLoading = true
|
|
|
this.saveEvaluation()
|
|
|
} else {
|
|
|
- //let requestData = {
|
|
|
- // id: paperInfo.id == undefined ? null : paperInfo.id,
|
|
|
- // code: this.examInfo.id,
|
|
|
- // schoolCode: this.$store.state.userInfo.schoolCode,
|
|
|
- // subjectCode: paperInfo.subjectCode,
|
|
|
- // periodCode: paperInfo.periodCode,
|
|
|
- // item: paperInfo.item,
|
|
|
- // score: paperInfo.score,
|
|
|
- // name: paperInfo.name
|
|
|
- //}
|
|
|
this.checkPaper(paperInfo)
|
|
|
this.$api.learnActivity.SaveExamPaper(paperInfo).then(
|
|
|
res => {
|
|
@@ -786,21 +573,15 @@
|
|
|
name: this.evaluationInfo.name,
|
|
|
creatorId: this.$store.state.userInfo.TEAMModelId,
|
|
|
type: this.evaluationInfo.type,
|
|
|
- period: {
|
|
|
- id: this.getPeriodInfo(this.evaluationInfo.school).id,
|
|
|
- name: this.getPeriodInfo(this.evaluationInfo.school).name
|
|
|
- },
|
|
|
- grades: this.gradeChoose,
|
|
|
+ period: this.evaluationInfo.period,
|
|
|
+ grades: this.evaluationInfo.grades,
|
|
|
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)
|
|
|
- },
|
|
|
+ examType: this.evaluationInfo.examType,
|
|
|
year: new Date().getFullYear(),
|
|
|
range: this.mode,
|
|
|
source: this.evaluationInfo.evaType,
|
|
|
- targetClassIds: this.classChoose,
|
|
|
+ targetClassIds: this.evaluationInfo.targetClassIds,
|
|
|
startTime: Math.round(new Date()),
|
|
|
endTime: this.evaluationInfo.endTime,
|
|
|
scope: this.mode,
|
|
@@ -817,7 +598,8 @@
|
|
|
this.$router.push({
|
|
|
name: datas
|
|
|
})
|
|
|
- this.evaluationInfo.papers = res.exam},500)
|
|
|
+ this.evaluationInfo.papers = res.exam
|
|
|
+ }, 500)
|
|
|
} else {
|
|
|
this.$Message.error('API ERROR!')
|
|
|
this.isLoading = false
|
|
@@ -829,15 +611,6 @@
|
|
|
}
|
|
|
)
|
|
|
},
|
|
|
- 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 = {
|
|
@@ -870,64 +643,27 @@
|
|
|
},
|
|
|
|
|
|
addSubject() {
|
|
|
- if (this.evaluationInfo.school !== '') {
|
|
|
- this.testSubject.length = []
|
|
|
- this.testSubject.push(this.getPeriodInfo(this.evaluationInfo.school))
|
|
|
- this.addSubjectBefore = [...this.testSubjects]
|
|
|
+ if (this.evaluationInfo.period !== '') {
|
|
|
this.addSubjectStatus = true
|
|
|
} else {
|
|
|
this.$Message.warning('请先选择测试学段!')
|
|
|
}
|
|
|
},
|
|
|
- //处理树结构数据
|
|
|
- convertTree(tree, map) {
|
|
|
- let result = []
|
|
|
- // 遍历 tree
|
|
|
- tree.forEach((item) => {
|
|
|
- // 读取 map 的键值映射
|
|
|
- let value = item[map.value]
|
|
|
- let title = item[map.label]
|
|
|
- let grade = item[map.values]
|
|
|
- let expand = true
|
|
|
- let children = item[map.children]
|
|
|
- // 如果有子节点,递归
|
|
|
- if (children !== undefined) {
|
|
|
- children = this.convertTree(children, map)
|
|
|
- }
|
|
|
- if (children !== undefined) {
|
|
|
- children.map(item => {
|
|
|
- item['type'] = 'class'
|
|
|
- item = delete item.children
|
|
|
- })
|
|
|
- }
|
|
|
- result.push({
|
|
|
- value,
|
|
|
- title,
|
|
|
- expand,
|
|
|
- children,
|
|
|
- grade
|
|
|
- })
|
|
|
- })
|
|
|
- return result
|
|
|
- }
|
|
|
},
|
|
|
created() {
|
|
|
+ this.$store.dispatch('user/getSchoolProfile').then(
|
|
|
+ res => {
|
|
|
+ this.schoolBase = res.school_base
|
|
|
+ }
|
|
|
+ )
|
|
|
let routerData = this.$route.params.evaluationInfo
|
|
|
if (routerData !== undefined) {
|
|
|
- this.startTime = new Date(routerData.startTime)
|
|
|
- this.endTime = new Date(routerData.endTime)
|
|
|
+ this.evaluationInfo.startTime = new Date(routerData.startTime)
|
|
|
+ this.evaluationInfo.endTime = new Date(routerData.endTime)
|
|
|
for (let i = 0; i < routerData.paperInfo.length; i++) {
|
|
|
routerData.paperInfo[i].createType = 'manualPaper'
|
|
|
}
|
|
|
this.evaluationInfo = routerData
|
|
|
- /**
|
|
|
- 处理无接口数据时返回为个人课程或校本课程
|
|
|
- */
|
|
|
- //if (routerData.paperInfo.length > 1) {
|
|
|
- // this.mode = 'school'
|
|
|
- //} else {
|
|
|
- // this.mode = 'class'
|
|
|
- //}
|
|
|
this.activeTab = 'preview'
|
|
|
}
|
|
|
this.findClassroom()
|
|
@@ -938,9 +674,48 @@
|
|
|
this.$Message.warning('页面参数错误,请重新进入')
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- evaluationInfo() {
|
|
|
- deep: true
|
|
|
+ computed: {
|
|
|
+ //计算当前学段下面的年级信息
|
|
|
+ curGrades(){
|
|
|
+ if (this.evaluationInfo.period) {
|
|
|
+ let res = this.schoolBase.period.filter((item) => {
|
|
|
+ return item.id == this.evaluationInfo.period.id
|
|
|
+ })
|
|
|
+ console.log('grades', res)
|
|
|
+ if (res.length > 0) {
|
|
|
+ return res[0].grades
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //计算当前学段下面的学科信息
|
|
|
+ curSubjects() {
|
|
|
+ if (this.evaluationInfo.period) {
|
|
|
+ let res = this.schoolBase.period.filter((item) => {
|
|
|
+ return item.id == this.evaluationInfo.period.id
|
|
|
+ })
|
|
|
+ if (res.length > 0) {
|
|
|
+ return res[0].subjects
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //学校定义的考试类型
|
|
|
+ testType() {
|
|
|
+ let curPeriod = this.schoolBase.period.filter(item => {
|
|
|
+ return item.id == this.evaluationInfo.period.id
|
|
|
+ })
|
|
|
+ if (curPeriod.length > 0) {
|
|
|
+ return curPeriod[0].analysis.type
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|