|
@@ -15,11 +15,6 @@
|
|
|
<div style="width:100%; height:calc(100% - 45px);padding-top:30px;" class="ivu-select-nochoose">
|
|
|
<vuescroll>
|
|
|
<Form ref="evaForm" :model="evaluationInfo" label-position="top" class="evaluation-attr-form light-iview-select light-iview-input light-el-input light-iview-input-number" label-colon :rules="ruleValidate">
|
|
|
- <!-- <FormItem :label="$t('learnActivity.createEv.evPeriod')" prop="period.id" v-if="mode == 'school'">
|
|
|
- <Select v-model="evaluationInfo.period.id" @on-change="setPeriodName" @on-open-change="checkChangePeriod" 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="$t('learnActivity.createEv.evName')" prop="name">
|
|
|
<Input v-special-char v-model="evaluationInfo.name" :placeholder="$t('learnActivity.createEv.evName')"></Input>
|
|
|
</FormItem>
|
|
@@ -46,8 +41,7 @@
|
|
|
</FormItem>
|
|
|
<!-- 校园评测施测对象为教学班或行政班 -->
|
|
|
<FormItem :label="$t('learnActivity.createEv.evTarget')" prop="targets">
|
|
|
- <el-cascader ref="evtarget" @visible-change="visibleChange" size="small" :show-all-levels="false" clearable filterable v-model="evaluationInfo.targets" :options="csOptions" :props="props" @change="treeChange" style="width:100%;">
|
|
|
- </el-cascader>
|
|
|
+ <SchoolTarget @on-change="treeChange"></SchoolTarget>
|
|
|
</FormItem>
|
|
|
<FormItem :label="$t('learnActivity.createEv.publishType')" prop="publish">
|
|
|
<Checkbox v-model="evaluationInfo.publish" :true-value="$GLOBAL.PUBLISH_TYPE()[0].value" :false-value="$GLOBAL.PUBLISH_TYPE()[1].value" @on-change="publishChange">
|
|
@@ -150,17 +144,8 @@ export default {
|
|
|
data() {
|
|
|
let _this = this
|
|
|
return {
|
|
|
- selectBefore: [],
|
|
|
showBack: false,
|
|
|
- schoolClasses: [],
|
|
|
- props: {
|
|
|
- multiple: true,
|
|
|
- value: 'id',
|
|
|
- label: 'name'
|
|
|
- },
|
|
|
- schoolBase: {
|
|
|
- period: []
|
|
|
- },
|
|
|
+ curPdInfo: {},
|
|
|
dateOpt: {
|
|
|
disabledDate(date) {
|
|
|
return date && date.valueOf() < Date.now() - 86400000
|
|
@@ -174,7 +159,6 @@ export default {
|
|
|
},
|
|
|
startTime: '',
|
|
|
endTime: '',
|
|
|
- privClassList: [],
|
|
|
examAnalysisStatus: false,
|
|
|
comfirmPreviewStatus: false,
|
|
|
addSubjectStatus: false,
|
|
@@ -247,8 +231,7 @@ export default {
|
|
|
befPeriod: {
|
|
|
id: '',
|
|
|
name: ''
|
|
|
- },
|
|
|
- stuList: []
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -286,20 +269,6 @@ export default {
|
|
|
this.showBack = false
|
|
|
}
|
|
|
},
|
|
|
- findStuList() {
|
|
|
- let params = {
|
|
|
- code: this.$store.state.userInfo.schoolCode,
|
|
|
- scope: 'school'
|
|
|
- }
|
|
|
- this.$api.courseMgmt.findStulist(params).then(
|
|
|
- res => {
|
|
|
- this.stuList = res.stuList
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error('API error')
|
|
|
- }
|
|
|
- )
|
|
|
- },
|
|
|
test() {
|
|
|
console.log(this.evaluationInfo)
|
|
|
},
|
|
@@ -351,40 +320,11 @@ export default {
|
|
|
}
|
|
|
// this.evaluationInfo.period.name = data.label
|
|
|
},
|
|
|
- //学段选择展开时
|
|
|
- checkChangePeriod(status) {
|
|
|
- if (status) {
|
|
|
- this.befPeriod = this._.cloneDeep(this.evaluationInfo.period)
|
|
|
- }
|
|
|
- },
|
|
|
- visibleChange(status) {
|
|
|
- if (status) {
|
|
|
- this.selectBefore = this._.cloneDeep(this.evaluationInfo.targets)
|
|
|
- }
|
|
|
- },
|
|
|
treeChange(data) {
|
|
|
- // 实现教学班和行政班二选一
|
|
|
+ this.evaluationInfo.targets = data
|
|
|
+ console.log('对象数据', data)
|
|
|
+ // 组件内部已实现教学班和行政班二选一
|
|
|
let finalData = data
|
|
|
- if (this.selectBefore.length) {
|
|
|
- let curType = new Set()
|
|
|
- data.forEach(item => {
|
|
|
- curType.add(item[0])
|
|
|
- })
|
|
|
- if (curType.size > 1) {
|
|
|
- let oldType = this.selectBefore[0][0]
|
|
|
- let newData = data.filter(item => {
|
|
|
- return item[0] != oldType
|
|
|
- })
|
|
|
- this.evaluationInfo.targets = []
|
|
|
- this.$refs.evtarget.panel.clearCheckedNodes()
|
|
|
- this.$refs.evtarget.panel.activePath = []
|
|
|
- this.selectBefore = newData
|
|
|
- this.evaluationInfo.targets = newData
|
|
|
- finalData = newData
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.selectBefore = data
|
|
|
- }
|
|
|
let classData = finalData.filter(item => {
|
|
|
return item[0] == 'class'
|
|
|
})
|
|
@@ -392,6 +332,11 @@ export default {
|
|
|
return item[0] == 'stulist'
|
|
|
})
|
|
|
|
|
|
+ if (!data.length) {
|
|
|
+ this.evaluationInfo.stuLists = []
|
|
|
+ this.evaluationInfo.classes = []
|
|
|
+ this.evaluationInfo.grades = []
|
|
|
+ }
|
|
|
// 如果是行政班
|
|
|
if (classData.length) {
|
|
|
//获取classIds
|
|
@@ -413,12 +358,13 @@ export default {
|
|
|
this.evaluationInfo.stuLists = []
|
|
|
}
|
|
|
//教学班
|
|
|
- else if (listData.length) {
|
|
|
+ if (listData.length) {
|
|
|
// 处理教学班对象
|
|
|
this.evaluationInfo.stuLists = listData.map(item => {
|
|
|
return item[1]
|
|
|
})
|
|
|
this.evaluationInfo.classes = []
|
|
|
+ this.evaluationInfo.grades = []
|
|
|
}
|
|
|
},
|
|
|
/*
|
|
@@ -858,13 +804,6 @@ export default {
|
|
|
this.evaluationInfo.startTime = new Date().getTime()
|
|
|
this.endTime = new Date(new Date(new Date().toLocaleDateString()).getTime() + 2 * 24 * 60 * 60 * 1000 - 1)
|
|
|
this.evaluationInfo.endTime = new Date(new Date().toLocaleDateString()).getTime() + 2 * 24 * 60 * 60 * 1000 - 1
|
|
|
-
|
|
|
- this.$store.dispatch('user/getSchoolProfile').then(
|
|
|
- res => {
|
|
|
- this.schoolBase = res.school_base
|
|
|
- this.schoolClasses = res.school_classes
|
|
|
- }
|
|
|
- )
|
|
|
//判断创建个人还是校本评测
|
|
|
if (this.$route.name == 'createSchoolEva') {
|
|
|
this.mode = 'school'
|
|
@@ -904,101 +843,28 @@ export default {
|
|
|
)
|
|
|
this.activeTab = 'preview'
|
|
|
}
|
|
|
- this.findStuList()
|
|
|
},
|
|
|
computed: {
|
|
|
- //级联选择年级班级
|
|
|
- csOptions() {
|
|
|
- let data = []
|
|
|
- //填充行政班数据
|
|
|
- if (this.evaluationInfo.period.id && this.schoolBase.period.length && this.schoolClasses.length) {
|
|
|
- let curPd = this.schoolBase.period.find((item) => {
|
|
|
- return item.id == this.evaluationInfo.period.id
|
|
|
- })
|
|
|
- data = [
|
|
|
- {
|
|
|
- id: 'class',
|
|
|
- name: this.$t('cusMgt.listType1'),
|
|
|
- children: []
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'stulist',
|
|
|
- name: this.$t('cusMgt.listType2'),
|
|
|
- // disabled: true,
|
|
|
- children: []
|
|
|
- }
|
|
|
- ]
|
|
|
- if (curPd) {
|
|
|
- //计算学级逻辑
|
|
|
- let date = new Date()
|
|
|
- let curYear = date.getFullYear()
|
|
|
- let month = date.getMonth() + 1
|
|
|
- let start = curPd.semesters.find(item => {
|
|
|
- return item.start == 1
|
|
|
- })
|
|
|
- // 根据入学月份确定当前年级和学级的关系
|
|
|
- if (start && month < start.month) {
|
|
|
- curYear--
|
|
|
- }
|
|
|
- curPd.grades.forEach((item, index) => {
|
|
|
- let dataItem = {
|
|
|
- id: index, //年级使用index
|
|
|
- name: `${item}(${curYear - index}${this.$t('unit.gradeYear')})`,
|
|
|
- year: curYear - index,
|
|
|
- children: []
|
|
|
- }
|
|
|
- let child = this.schoolClasses.filter(classItem => {
|
|
|
- return (classItem.year == curYear - index) && classItem.periodId == this.evaluationInfo.period.id
|
|
|
- })
|
|
|
- dataItem.children = child.length ? child : undefined
|
|
|
- data[0].children.push(dataItem)
|
|
|
- })
|
|
|
- }
|
|
|
- // 填充教学班数据
|
|
|
- let curStuList = this.stuList.filter(item => {
|
|
|
- return item.periodId == this.evaluationInfo.period.id
|
|
|
- })
|
|
|
- data[1].children.push(...curStuList)
|
|
|
- }
|
|
|
- return data
|
|
|
- },
|
|
|
//计算当前学段下面的年级信息
|
|
|
curGrades() {
|
|
|
- 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].grades
|
|
|
- } else {
|
|
|
- return []
|
|
|
- }
|
|
|
+ if (this.evaluationInfo.period && this.curPdInfo.grades) {
|
|
|
+ return this.curPdInfo.grades
|
|
|
} 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 []
|
|
|
- }
|
|
|
+ if (this.evaluationInfo.period && this.curPdInfo.subjects) {
|
|
|
+ return this.curPdInfo.subjects
|
|
|
} 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
|
|
|
+ if (this.curPdInfo.analysis && this.curPdInfo.analysis.type) {
|
|
|
+ return this.curPdInfo.analysis.type
|
|
|
} else {
|
|
|
return []
|
|
|
}
|
|
@@ -1010,6 +876,7 @@ export default {
|
|
|
immediate: true,
|
|
|
handler(n, o) {
|
|
|
if (n) {
|
|
|
+ this.curPdInfo = n
|
|
|
console.log(n)
|
|
|
this.setPeriodName(n)
|
|
|
this.evaluationInfo.income = n.analysis ? n.analysis.income : 0
|