|
@@ -18,7 +18,7 @@
|
|
|
<Option v-for="(item,index) in classRooms.filter(i=>i.scope === classType)" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
</Select> -->
|
|
|
<div v-else>
|
|
|
- <BaseClassSelect :classes="classTargets" @onChange="onTargetChange" ref="classSelectRef" v-if="getCurScope === 'school' && curVoteItem"></BaseClassSelect>
|
|
|
+ <BaseClassSelect :classes="classTargets" :type="targetType" @onChange="onTargetChange" ref="classSelectRef" v-if="getCurScope === 'school' && curVoteItem"></BaseClassSelect>
|
|
|
<BaseClassSelectPri :classes="classTargets" :scope="classType" @onChange="onTargetChange" ref="classSelectRef" v-if="getCurScope === 'private' && curVoteItem"></BaseClassSelectPri>
|
|
|
</div>
|
|
|
|
|
@@ -214,7 +214,9 @@
|
|
|
return data && data > date.valueOf() + 86400000
|
|
|
}
|
|
|
},
|
|
|
- classIds:[]
|
|
|
+ classIds:[],
|
|
|
+ groupList:[],
|
|
|
+ targetType:''
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -223,6 +225,8 @@
|
|
|
console.log(res)
|
|
|
this.classRooms = res
|
|
|
})
|
|
|
+
|
|
|
+ this.findResearchList()
|
|
|
},
|
|
|
methods: {
|
|
|
onClassTypeChange(val) {
|
|
@@ -270,11 +274,12 @@
|
|
|
let fileName = this.$tools.guid()
|
|
|
let isReset = this.voteForm.isReset.length > 0
|
|
|
let isPersonal = this.$route.name === 'personalVote' && classSelectScope === 'private'
|
|
|
+ let isSchool = this.$route.name === 'manageVote'
|
|
|
+
|
|
|
params.code = this.getCurCode
|
|
|
params.scope = isPersonal ? 'private' : 'school'
|
|
|
params.name = this.voteForm.name
|
|
|
- params.startTime = !this.isImmediate ? new Date(this.voteForm.startTime)
|
|
|
- .getTime() : -1
|
|
|
+ params.startTime = !this.isImmediate ? new Date(this.voteForm.startTime).getTime() : -1
|
|
|
params.endTime = new Date(this.voteForm.endTime).getTime()
|
|
|
params.description = this.voteForm.description
|
|
|
params.targets = this.voteForm.targets
|
|
@@ -283,19 +288,27 @@
|
|
|
params.repeat = this.voteForm.repeat.indexOf('repeat') > -1
|
|
|
params.options = this.voteOptionsContent
|
|
|
// 新增参数
|
|
|
- params.owner = this.$route.name === 'personalVote' ? 'teacher' : 'school'
|
|
|
+ params.owner = isSchool ? 'school' : 'teacher'
|
|
|
params.creatorId = this.$store.state.userInfo.TEAMModelId
|
|
|
params.voteNum = this.voteForm.selectMax
|
|
|
params.times = this.voteForm.times
|
|
|
params.school = params.scope === 'school' ? this.$store.state.userInfo.schoolCode : null
|
|
|
-
|
|
|
+ params.tchLists = []
|
|
|
+ params.classes = []
|
|
|
+ params.stuLists = []
|
|
|
if (this.isEdit && this.editInfo.id && this.editInfo.code) {
|
|
|
params.id = this.editInfo.id
|
|
|
}
|
|
|
- if(isSchoolClass){
|
|
|
+ // 如果是校本投票 则需要进一步确定发布对象是教研组还是学生名单
|
|
|
+ if(isSchool && this.$refs.classSelectRef.targetType === 'research'){
|
|
|
+ params.tchLists = this.voteForm.classes
|
|
|
+ params.targetType = 'research'
|
|
|
+ }else if(isSchoolClass){
|
|
|
params.classes = this.voteForm.classes
|
|
|
+ params.targetType = 'student'
|
|
|
}else{
|
|
|
params.stuLists = this.voteForm.classes
|
|
|
+ params.targetType = 'student'
|
|
|
}
|
|
|
console.log('提交的投票对象',params)
|
|
|
/* 保存BLOB以及COSMOS */
|
|
@@ -529,16 +542,23 @@
|
|
|
* @param item
|
|
|
*/
|
|
|
async doRender(item) {
|
|
|
- console.log(item)
|
|
|
- // if(!this.classRooms.length){
|
|
|
- // this.classRooms = await this.getClassrooms(this.userInfo.TEAMModelId)
|
|
|
- // }
|
|
|
- if(item.id){
|
|
|
- this.classNameArr = item.classes.length ? await this.getClassNameByIds(item.classes) : await this.getClassNameByIds(item.stuLists)
|
|
|
- // this.classTargets = item.targets
|
|
|
+ console.log('需要渲染的投票对象',item)
|
|
|
+ if(item.targetType === 'research'){
|
|
|
+ console.log(this.groupList);
|
|
|
+ let groupNameArr = []
|
|
|
+ item.tchLists.forEach(i => {
|
|
|
+ let findObj = this.groupList.find(j => j.id === i)
|
|
|
+ if(findObj){
|
|
|
+ groupNameArr.push(findObj)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.classNameArr = groupNameArr
|
|
|
+ }else{
|
|
|
+ this.classNameArr = item.classes.length ? await this.getClassNameByIds(item.classes) : item.stuLists.length ? await this.getClassNameByIds(item.stuLists) : []
|
|
|
}
|
|
|
this.classType = item.classes.length ? 'school' : 'private'
|
|
|
- this.classTargets = item.classes.length ? item.classes : item.stuLists
|
|
|
+ this.classTargets = item.targetType === 'research' ? item.tchLists : this.getCurScope === 'school' ? item.classes : item.targets
|
|
|
+ this.targetType = item.targetType
|
|
|
console.log(this.classNameArr)
|
|
|
this.voteForm = null
|
|
|
this.voteOptionsContent = []
|
|
@@ -547,7 +567,8 @@
|
|
|
this.voteForm = {
|
|
|
name: item.name,
|
|
|
code: item.code,
|
|
|
- classes: this.classTargets,
|
|
|
+ targets: item.targets,
|
|
|
+ classes: item.targetType === 'research' ? item.tchLists : item.classes.length ? item.classes : item.stuLists,
|
|
|
startTime: item.startTime ? new Date(item.startTime) : '',
|
|
|
endTime: item.endTime ? new Date(item.endTime) : '',
|
|
|
description: item.description,
|
|
@@ -600,7 +621,17 @@
|
|
|
// }
|
|
|
console.log(classId);
|
|
|
return this.classNameArr.find(i => i.id === classId) ? this.classNameArr.find(i => i.id === classId).name : this.$t('vote.form.noMatchDataTip')
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 查找学校检验组信息 */
|
|
|
+ findResearchList(){
|
|
|
+ this.$api.schoolUser.getResearchGroup({
|
|
|
+ code:this.$store.state.userInfo.schoolCode,
|
|
|
+ scope:'school'
|
|
|
+ }).then(res => {
|
|
|
+ this.groupList = res.stuList
|
|
|
+ })
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
//this.initEditors()
|
|
@@ -611,6 +642,7 @@
|
|
|
this.$editorTools.initSimpleEditor(descriptionEditor,this)
|
|
|
descriptionEditor.create()
|
|
|
this.descriptionEditor = descriptionEditor
|
|
|
+
|
|
|
|
|
|
if (this.editItem && this.editItem.name) {
|
|
|
console.log(this.editItem)
|