|
@@ -30,7 +30,7 @@
|
|
</FormItem>
|
|
</FormItem>
|
|
<FormItem :label="$t('learnActivity.createEv.courseType')" prop="course">
|
|
<FormItem :label="$t('learnActivity.createEv.courseType')" prop="course">
|
|
<Select v-model="evaluationInfo.scope" @on-change="resetCourse">
|
|
<Select v-model="evaluationInfo.scope" @on-change="resetCourse">
|
|
- <Option value="teacher">{{$t('learnActivity.createEv.cusLabel1')}}</Option>
|
|
|
|
|
|
+ <Option value="school">{{$t('learnActivity.createEv.cusLabel1')}}</Option>
|
|
<Option value="private">{{$t('learnActivity.createEv.cusLabel2')}}</Option>
|
|
<Option value="private">{{$t('learnActivity.createEv.cusLabel2')}}</Option>
|
|
</Select>
|
|
</Select>
|
|
</FormItem>
|
|
</FormItem>
|
|
@@ -111,53 +111,55 @@ export default {
|
|
lazy: true,
|
|
lazy: true,
|
|
lazyLoad(node, resolve) {
|
|
lazyLoad(node, resolve) {
|
|
const { level } = node
|
|
const { level } = node
|
|
- let scope = _this.evaluationInfo.scope == "teacher" ? 'school' : 'teacher'
|
|
|
|
- if (level == 0) {
|
|
|
|
- if (_this.courseList.length == 0) {
|
|
|
|
- let requestData = {
|
|
|
|
- 'code': _this.$store.state.userInfo.TEAMModelId,
|
|
|
|
- 'schoolId': _this.$store.state.userInfo.schoolCode,
|
|
|
|
- 'scope': 'private'
|
|
|
|
- }
|
|
|
|
- _this.$api.courseMgmt.findCourse(requestData).then(
|
|
|
|
- (res) => {
|
|
|
|
- if (res.error == null) {
|
|
|
|
- _this.courseList = res.courses
|
|
|
|
- let scope = _this.evaluationInfo.scope == "teacher" ? 'school' : 'teacher'
|
|
|
|
- let curCus = _this.courseList.filter(item => {
|
|
|
|
- return item.scope == scope
|
|
|
|
- })
|
|
|
|
- let nodes = curCus.map(item => {
|
|
|
|
- return {
|
|
|
|
- value: item.id,
|
|
|
|
- label: item.name,
|
|
|
|
- leaf: level >= 1
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- resolve(nodes)
|
|
|
|
- } else {
|
|
|
|
- _this.$Message.error('API ERROR!')
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- (err) => {
|
|
|
|
|
|
+ let scope = _this.evaluationInfo.scope
|
|
|
|
+ // 一级菜单首次加载
|
|
|
|
+ if (level == 0 && _this.courseList.length == 0) {
|
|
|
|
+ let requestData = {
|
|
|
|
+ 'code': _this.$store.state.userInfo.TEAMModelId,
|
|
|
|
+ 'schoolId': _this.$store.state.userInfo.schoolCode,
|
|
|
|
+ 'scope': 'private'
|
|
|
|
+ }
|
|
|
|
+ _this.$api.courseMgmt.findCourse(requestData).then(
|
|
|
|
+ (res) => {
|
|
|
|
+ if (res.error) {
|
|
_this.$Message.error('API ERROR!')
|
|
_this.$Message.error('API ERROR!')
|
|
|
|
+ return
|
|
}
|
|
}
|
|
- )
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- let curCus = _this.courseList.filter(item => {
|
|
|
|
- return item.scope == scope
|
|
|
|
- })
|
|
|
|
- let nodes = curCus.map(item => {
|
|
|
|
- return {
|
|
|
|
- value: item.id,
|
|
|
|
- label: item.name,
|
|
|
|
- leaf: true
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- resolve(nodes)
|
|
|
|
- }
|
|
|
|
- } else if (level == 1) {
|
|
|
|
|
|
+ _this.courseList = res.courses
|
|
|
|
+ let scope = _this.evaluationInfo.scope
|
|
|
|
+ let curCus = _this.courseList.filter(item => {
|
|
|
|
+ return item.scope == scope
|
|
|
|
+ })
|
|
|
|
+ let nodes = curCus.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ value: item.id,
|
|
|
|
+ label: item.name,
|
|
|
|
+ leaf: level >= 1
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ resolve(nodes)
|
|
|
|
+ },
|
|
|
|
+ (err) => {
|
|
|
|
+ _this.$Message.error('API ERROR!')
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ // 一级菜单非首次加载
|
|
|
|
+ else if (level == 0 && _this.courseList.length > 0) {
|
|
|
|
+ let curCus = _this.courseList.filter(item => {
|
|
|
|
+ return item.scope == scope
|
|
|
|
+ })
|
|
|
|
+ let nodes = curCus.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ value: item.id,
|
|
|
|
+ label: item.name,
|
|
|
|
+ leaf: true
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ resolve(nodes)
|
|
|
|
+ }
|
|
|
|
+ // 加载二级菜单
|
|
|
|
+ else if (level == 1) {
|
|
console.log(node)
|
|
console.log(node)
|
|
let course = node.data
|
|
let course = node.data
|
|
let requestData = {
|
|
let requestData = {
|
|
@@ -166,67 +168,68 @@ export default {
|
|
'id': course.value
|
|
'id': course.value
|
|
}
|
|
}
|
|
_this.$api.courseMgmt.findCusInfo(requestData).then(
|
|
_this.$api.courseMgmt.findCusInfo(requestData).then(
|
|
- (res) => {
|
|
|
|
- if (!res.error) {
|
|
|
|
- if (res.courses && res.courses.length > 0) {
|
|
|
|
- res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
|
|
|
|
- res.courses[0].schedule.forEach(item => {
|
|
|
|
- if (item.classId) {
|
|
|
|
- let classInfo = _this.schoolClassList.find(classItem => {
|
|
|
|
- return classItem.id == item.classId
|
|
|
|
- })
|
|
|
|
- if (classInfo) {
|
|
|
|
- item.classInfo = {
|
|
|
|
- id: item.classId,
|
|
|
|
- name: classInfo.name
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- item.classInfo = {
|
|
|
|
- id: item.classId,
|
|
|
|
- name: '未找到'
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (item.stulist) {
|
|
|
|
- let listInfo = _this.stuList.find(listItem => {
|
|
|
|
- return listItem.id == item.stulist
|
|
|
|
- })
|
|
|
|
- if (listInfo) {
|
|
|
|
- item.listName = listInfo.name
|
|
|
|
- } else {
|
|
|
|
- item.listName = '未找到对应名单'
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
|
|
+ async (res) => {
|
|
|
|
+ if (res.error) {
|
|
|
|
+ resolve([])
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 获取自定义名单信息
|
|
|
|
+ let ids = res.courses[0].schedule.map(item => {
|
|
|
|
+ return item.stulist
|
|
|
|
+ })
|
|
|
|
+ for (let i = 0; i < ids.length; i++) {
|
|
|
|
+ if (!ids[i]) {
|
|
|
|
+ ids.splice(i, 1)
|
|
|
|
+ i--
|
|
}
|
|
}
|
|
- let schedule = res.courses[0].schedule.filter(item => {
|
|
|
|
- return item.teacher.id == _this.$store.state.userInfo.TEAMModelId //teacherId尚未处理,暂时用teacher.id
|
|
|
|
- })
|
|
|
|
- console.log('***',schedule)
|
|
|
|
- let nodes = schedule.map(item => {
|
|
|
|
- return {
|
|
|
|
- value: item.stulist || item.classId,
|
|
|
|
- label: item.listName || item.classInfo.name,
|
|
|
|
- leaf: false
|
|
|
|
|
|
+ }
|
|
|
|
+ if (ids.length) {
|
|
|
|
+ try {
|
|
|
|
+ let listRes = await _this.getListInfo([...ids])
|
|
|
|
+ if (listRes) _this.stuList.push(...listRes.stuList)
|
|
|
|
+ } catch (e) {
|
|
|
|
+ _this.$Message.error('获取自定义名单失败')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (res.courses && res.courses.length > 0) {
|
|
|
|
+ res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
|
|
|
|
+ res.courses[0].schedule.forEach(item => {
|
|
|
|
+ // 补充教室信息
|
|
|
|
+ if (item.classId) {
|
|
|
|
+ let classInfo = _this.schoolClassList.find(classItem => {
|
|
|
|
+ return classItem.id == item.classId
|
|
|
|
+ })
|
|
|
|
+ item.classInfo = {
|
|
|
|
+ id: item.classId,
|
|
|
|
+ name: classInfo ? `${classInfo.name}(默认名单)` : '--'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 补充名单信息
|
|
|
|
+ if (item.stulist) {
|
|
|
|
+ let listInfo = _this.stuList.find(listItem => {
|
|
|
|
+ return listItem.id == item.stulist
|
|
|
|
+ })
|
|
|
|
+ item.listName = listInfo ? `${listInfo.name}(自定义名单)` : '--'
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- resolve(nodes)
|
|
|
|
}
|
|
}
|
|
|
|
+ let schedule = res.courses[0].schedule.filter(item => {
|
|
|
|
+ return item.teacherId == _this.$store.state.userInfo.TEAMModelId && (item.stulist || item.classId)
|
|
|
|
+ })
|
|
|
|
+ let nodes = schedule.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ value: item.stulist || item.classId,
|
|
|
|
+ label: item.listName || item.classInfo.name,
|
|
|
|
+ leaf: level >= 1
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ resolve(nodes)
|
|
}
|
|
}
|
|
)
|
|
)
|
|
|
|
+ } else {
|
|
|
|
+ resolve([])
|
|
}
|
|
}
|
|
-
|
|
|
|
- // setTimeout(() => {
|
|
|
|
- // const nodes = Array.from({ length: level + 1 })
|
|
|
|
- // .map(item => ({
|
|
|
|
- // value: ++id,
|
|
|
|
- // label: `选项${id}`,
|
|
|
|
- // leaf: level >= 2
|
|
|
|
- // }));
|
|
|
|
- // // 通过调用resolve将子节点数据返回,通知组件数据加载完成
|
|
|
|
- // resolve(nodes);
|
|
|
|
- // }, 1000);
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
schoolBase: {
|
|
schoolBase: {
|
|
@@ -277,7 +280,7 @@ export default {
|
|
name: '',
|
|
name: '',
|
|
targets: [],
|
|
targets: [],
|
|
targetClassIds: [],
|
|
targetClassIds: [],
|
|
- scope: 'teacher',
|
|
|
|
|
|
+ scope: 'school',
|
|
type: '', //测试类别
|
|
type: '', //测试类别
|
|
source: '',
|
|
source: '',
|
|
publish: '0',
|
|
publish: '0',
|
|
@@ -288,11 +291,20 @@ export default {
|
|
papers: []
|
|
papers: []
|
|
},
|
|
},
|
|
mode: '',
|
|
mode: '',
|
|
- selectBefore: []
|
|
|
|
|
|
+ selectBefore: [],
|
|
|
|
+ stuList: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
-
|
|
|
|
|
|
+ //根据id获取stulist信息
|
|
|
|
+ getListInfo(ids) {
|
|
|
|
+ let requestData = {
|
|
|
|
+ 'code': this.evaluationInfo.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
|
|
|
|
+ 'scope': this.evaluationInfo.scope,
|
|
|
|
+ 'ids': ids
|
|
|
|
+ }
|
|
|
|
+ return this.$api.courseMgmt.findListSummary(requestData)
|
|
|
|
+ },
|
|
//重置课程类型
|
|
//重置课程类型
|
|
resetCourse() {
|
|
resetCourse() {
|
|
this.evaluationInfo.targets = []
|
|
this.evaluationInfo.targets = []
|
|
@@ -510,7 +522,7 @@ export default {
|
|
//设置测试“学科”
|
|
//设置测试“学科”
|
|
this.evaluationInfo.subjects = []
|
|
this.evaluationInfo.subjects = []
|
|
if (this.evaluationInfo.targets.length) {
|
|
if (this.evaluationInfo.targets.length) {
|
|
- if (this.evaluationInfo.scope == 'teacher') {
|
|
|
|
|
|
+ if (this.evaluationInfo.scope == 'school') {
|
|
let res = this.schoolTree.filter(item => {
|
|
let res = this.schoolTree.filter(item => {
|
|
return item.value == this.evaluationInfo.targets[0][0]
|
|
return item.value == this.evaluationInfo.targets[0][0]
|
|
})
|
|
})
|
|
@@ -655,7 +667,7 @@ export default {
|
|
endTime: this.evaluationInfo.endTime,
|
|
endTime: this.evaluationInfo.endTime,
|
|
scope: this.evaluationInfo.scope,
|
|
scope: this.evaluationInfo.scope,
|
|
createDate: Math.round(new Date()),
|
|
createDate: Math.round(new Date()),
|
|
- owner: this.evaluationInfo.scope == 'teacher' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId //后面新增字段
|
|
|
|
|
|
+ owner: this.evaluationInfo.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId //后面新增字段
|
|
}
|
|
}
|
|
|
|
|
|
this.$api.learnActivity.SaveExamInfo(requestData).then(
|
|
this.$api.learnActivity.SaveExamInfo(requestData).then(
|