Explorar el Código

处理阅卷返回数据格式调整

liqk hace 3 años
padre
commit
4d101d2409

+ 33 - 4
TEAMModelOS/ClientApp/src/view/learnactivity/markpaper/MarkSetting.vue

@@ -650,7 +650,7 @@ export default {
                                 curSubData.markers.push({
                                 curSubData.markers.push({
                                     id: teacher.id,
                                     id: teacher.id,
                                     name: teacher.name,
                                     name: teacher.name,
-                                    qu: block.quNo.sort((a,b)=>{
+                                    qu: block.quNo.sort((a, b) => {
                                         return a - b
                                         return a - b
                                     }),
                                     }),
                                     count: c
                                     count: c
@@ -659,10 +659,10 @@ export default {
                         })
                         })
                     }
                     }
                 })
                 })
-            }else{
+            } else {
                 //如果先设置按题分配,然后切换成按人分配需要清空qu
                 //如果先设置按题分配,然后切换成按人分配需要清空qu
-                this.setting.subs.forEach(subItem=>{
-                    subItem.markers.forEach(t=>{
+                this.setting.subs.forEach(subItem => {
+                    subItem.markers.forEach(t => {
                         t.qu = []
                         t.qu = []
                     })
                     })
                 })
                 })
@@ -726,6 +726,35 @@ export default {
                     if (res.correct) {
                     if (res.correct) {
                         this.setting = res.correct
                         this.setting = res.correct
                         this.isSetting = true
                         this.isSetting = true
+                        //如果是按题分配模式需要转换数据格式
+                        if (this.setting.mode == 'qu') {
+                            this.quBlockes = []
+                            this.setting.subs.forEach(subItem => {
+                                let item = {
+                                    id: subItem.id,
+                                    name: subItem.name,
+                                    quBlock: []
+                                }
+                                //根据题块进行分组
+                                let group = this.$jsFn.groupBy(subItem.markers, 'qu')
+                                group.forEach(gItem => {
+                                    let qItem = {
+                                        id: this.$jsFn.uuid(),
+                                        quNo: gItem[0].qu,
+                                        teachers: []
+                                    }
+                                    gItem.forEach(tItem => {
+                                        qItem.teachers.push({
+                                            id: tItem.id,
+                                            name: tItem.name
+                                        })
+                                    })
+                                    item.quBlock.push(qItem)
+                                })
+                                this.quBlockes.push(item)
+                            })
+                            console.log('处理结果',this.quBlockes)
+                        }
                     } else {
                     } else {
                         this.isSetting = false
                         this.isSetting = false
                         if (this.evInfo.subjects) {
                         if (this.evInfo.subjects) {