浏览代码

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

CrazyIter_Bin 3 年之前
父节点
当前提交
e900704c3d

+ 4 - 1
TEAMModelFunction/TriggerExam.cs

@@ -196,12 +196,15 @@ namespace TEAMModelFunction
                                         result.info.id = cla;
                                         List<string> ans = new List<string>();
                                         List<List<string>> anses = new List<List<string>>();
+                                        List<List<Details>> marks = new List<List<Details>>();
                                         List<double> ansPoint = new List<double>();
                                         List<string> ids = new List<string>();
                                         foreach (double p in info.papers[m].point)
                                         {
+                                            //Details details = new Details();
                                             //ans.Add(new List<string>());
                                             anses.Add(new List<string>());
+                                            marks.Add(new List<Details>());
                                             ansPoint.Add(-1);
                                         }
                                         var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.school}"));
@@ -290,7 +293,7 @@ namespace TEAMModelFunction
                                         }
                                         foreach (string stu in ids)
                                         {
-                                            result.mark.Add(ans);
+                                            result.mark.Add(marks);
                                             result.studentIds.Add(stu);
                                             result.studentAnswers.Add(ans);
                                             result.studentScores.Add(ansPoint);

+ 11 - 2
TEAMModelOS.SDK/Models/Cosmos/Common/ExamClassResult.cs

@@ -17,7 +17,7 @@ namespace TEAMModelOS.SDK.Models
             studentIds = new List<string>();
             studentScores = new List<List<double>>();
             sum = new List<double>();
-            mark = new List<List<string>>();
+            mark = new List<List<List<Details>>>();
             ans = new List<List<List<string>>>();
         }
         public string school { get; set; }
@@ -35,7 +35,7 @@ namespace TEAMModelOS.SDK.Models
         public List<List<List<string>>> ans { get; set; }
         public List<List<double>> studentScores { get; set; }
         //批注
-        public List<List<string>> mark { get; set; }
+        public List<List<List<Details>>> mark { get; set; }
         public string scope { get; set; }
         public List<double> sum { get; set; }
         public double average { get; set; }
@@ -69,4 +69,13 @@ namespace TEAMModelOS.SDK.Models
         //public string from { get; set; }
         //public string code { get; set; }
     }
+    public class Details {
+        public double sc { get; set; }
+        public string tmdId { get; set; }
+        //记录老师批注信息
+        public string mark { get; set; }
+        //记录老师身份信息
+        public string identity { get; set; }
+        public int index { get; set; }
+    }
 }

+ 1 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/Scoring.cs

@@ -53,6 +53,7 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Common
                     if (sc.Count > 0) {
                         return true;
                     }
+                    //double diff = Math.Abs(scores.Where(c => c.identity.Equals("")).Select(s => s.sc).ToList().Aggregate((i, j) => (i - j) * 6));
                     double diff = Math.Abs(scores.Select(s => s.sc).ToList().Aggregate((i, j) => (i - j) * 6));
                     if (diff > ssc)
                     {

+ 4 - 1
TEAMModelOS/ClientApp/src/common/BaseClassSelect.vue

@@ -84,7 +84,10 @@
 			}
 		},
 		mounted() {
-			console.log(this.classes);
+			this.$EventBus.$off('onCreateVote')
+			this.$EventBus.$on('onCreateVote',() => {
+				this.defaultArr = []
+			})
 		},
 		computed: {
 			csOptions() {

+ 220 - 210
TEAMModelOS/ClientApp/src/common/BaseClassSelectPri.vue

@@ -1,218 +1,228 @@
 <template>
-	<div class="base-class-select dark-el-cascader">
-		<RadioGroup v-model="evaluationInfo.scope" @on-change="onClassTypeChange" style="margin-bottom: 10px;">
-			<Radio label="private">{{ $t('survey.form.privateClass') }}</Radio>
-			<Radio label="school">{{ $t('survey.form.schoolClass') }}</Radio>
-		</RadioGroup>
-		<el-cascader :props="props" :options="curCusList" @change="treeChange" :show-all-levels="false" clearable
-			filterable></el-cascader>
-	</div>
+    <div class="base-class-select dark-el-cascader">
+        <RadioGroup v-model="evaluationInfo.scope" @on-change="onClassTypeChange" style="margin-bottom: 10px;">
+            <Radio label="private">{{ $t('survey.form.privateClass') }}</Radio>
+            <Radio label="school">{{ $t('survey.form.schoolClass') }}</Radio>
+        </RadioGroup>
+        <el-cascader :props="props" :options="curCusList" @change="treeChange" :show-all-levels="false" clearable filterable></el-cascader>
+    </div>
 </template>
 
 <script>
-	export default {
-		props:{
-			scope:{
-				type:String,
-				default:'school'
-			}
-		},
-		data() {
-			const _this = this
-			return {
-				schoolBase: {
-				    period: []
-				},
-				courseList:[],
-				stuList:[],
-				schoolClassList:[],
-				classes: [],
-				evaluationInfo:{
-					scope:'school'
-				},
-				props: {
-				    multiple: true,
-				    lazy: true,
-				    lazyLoad(node, resolve) {
-				        const { level } = node
-				        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!')
-				                        return
-				                    }
-				                    _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)
-				            let course = node.data
-				            let requestData = {
-				                'code': scope == 'school' ? _this.$store.state.userInfo.schoolCode : _this.$store.state.userInfo.TEAMModelId,
-				                'scope': scope,
-				                'id': course.value
-				            }
-				            _this.$api.courseMgmt.findCusInfo(requestData).then(
-				                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--
-				                        }
-				                    }
-				                    if (ids.length) {
-				                        try {
-				                            let listRes = await _this.getListInfo([...ids])
-				                            if (listRes) _this.stuList.push(...listRes.stuList)
-				                        } catch (e) {
-											console.log(e)
-				                            _this.$Message.error('API 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}` : ' - -'
-				                            }
-				                        })
-				                    }
-				                    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([])
-				        }
-				    }
-				},
-			};
-		},
-		methods: {
-			treeChange(data) {
-				let classIds = data.map(i => i[i.length - 1])
-				this.classes = classIds
-				this.$emit('onChange', classIds)
-			},
-			onClassTypeChange(val){
-				this.evaluationInfo.scope = val
-			},
-			//根据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)
-			},
-		},
-		mounted() {
-			this.$store.dispatch('user/getSchoolProfile').then(
-			    res => {
-			        this.schoolBase = res.school_base
-			        this.schoolClassList = res.school_classes
-			    }
-			)
-		},
-		computed: {
-			curCusList() {
-			    let cus = this.courseList.filter(item => {
-			        return item.scope == this.evaluationInfo.scope
-			    })
-			    let nodes = cus.map(item => {
-			        return {
-			            value: item.id,
-			            label: item.name,
-			            leaf: false
-			        }
-			    })
-			    return nodes
-			},
-		}
-	};
+export default {
+    props: {
+        scope: {
+            type: String,
+            default: 'school'
+        }
+    },
+    data() {
+        const _this = this
+        return {
+            schoolBase: {
+                period: []
+            },
+            courseList: [],
+            stuList: [],
+            schoolClassList: [],
+            classes: [],
+            evaluationInfo: {
+                scope: 'school'
+            },
+            props: {
+                multiple: true,
+                lazy: true,
+                lazyLoad(node, resolve) {
+                    const { level } = node
+                    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!')
+                                    return
+                                }
+                                _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)
+                        let course = node.data
+                        let requestData = {
+                            'code': scope == 'school' ? _this.$store.state.userInfo.schoolCode : _this.$store.state.userInfo.TEAMModelId,
+                            'scope': scope,
+                            'id': course.value
+                        }
+                        _this.$api.courseMgmt.findCusInfo(requestData).then(
+                            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--
+                                    }
+                                }
+                                if (ids.length) {
+                                    try {
+                                        let listRes = await _this.getListInfo([...ids])
+                                        if (listRes) _this.stuList.push(...listRes.stuList)
+                                    } catch (e) {
+                                        console.log(e)
+                                        _this.$Message.error('API error')
+                                    }
+                                }
+                                //一个名单被安排到不同教室上课会出现重复数据,这里需要去重
+                                let list = []
+                                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}` : ' - -'
+                                        }
+                                        //统一数据格式
+                                        item.classId = item.classId || undefined
+                                        item.stulist = item.stulist || undefined
+                                        // 一个名单被安排到不同教室上课会出现重复数据,这里做去重操作
+                                        let has = list.find(listItem => {
+                                            return listItem.classId == item.classId && item.stulist == listItem.stulist
+                                        })
+                                        if (!has) {
+                                            list.push(item)
+                                        }
+                                    })
+                                    res.courses[0].teaClasses = list.filter(item => {
+                                        return item.classId || item.stulist
+                                    })
+                                }
+
+                                let nodes = res.courses[0].teaClasses.map(item => {
+                                    return {
+                                        value: item.stulist || item.classId,
+                                        label: item.listName || item.classInfo.name,
+                                        leaf: level >= 1
+                                    }
+                                })
+                                resolve(nodes)
+                            }
+                        )
+                    } else {
+                        resolve([])
+                    }
+                }
+            },
+        };
+    },
+    methods: {
+        treeChange(data) {
+            let classIds = data.map(i => i[i.length - 1])
+            this.classes = classIds
+            this.$emit('onChange', classIds)
+        },
+        onClassTypeChange(val) {
+            this.evaluationInfo.scope = val
+        },
+        //根据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)
+        },
+    },
+    mounted() {
+        this.$store.dispatch('user/getSchoolProfile').then(
+            res => {
+                this.schoolBase = res.school_base
+                this.schoolClassList = res.school_classes
+            }
+        )
+    },
+    computed: {
+        curCusList() {
+            let cus = this.courseList.filter(item => {
+                return item.scope == this.evaluationInfo.scope
+            })
+            let nodes = cus.map(item => {
+                return {
+                    value: item.id,
+                    label: item.name,
+                    leaf: false
+                }
+            })
+            return nodes
+        },
+    }
+};
 </script>
 <style lang="less">
-	.base-class-select {
-		.el-cascader {
-			width: 100%;
-
-			.el-input__inner {
-				background-color: #353535;
-				border: none;
-			}
-		}
+.base-class-select {
+    .el-cascader {
+        width: 100%;
 
-	}
+        .el-input__inner {
+            background-color: #353535;
+            border: none;
+        }
+    }
+}
 </style>

+ 5 - 5
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnForm.vue

@@ -20,7 +20,7 @@
 						:key="index">{{ item.name }}</Option>
 				</Select> -->
 				<div v-else>
-					<BaseClassSelect :classes="qnForm.classes" @onChange="onTargetChange" v-if="getCurScope === 'school'"></BaseClassSelect>
+					<BaseClassSelect :classes="classNameArr" @onChange="onTargetChange" v-if="getCurScope === 'school'"></BaseClassSelect>
 					<BaseClassSelectPri @onChange="onTargetChange" v-else></BaseClassSelectPri>
 				</div>
 			</FormItem>
@@ -326,10 +326,10 @@
 				this.currentState = item.state
 				this.$nextTick(() => {
 					this.curQnItem = JSON.parse(JSON.stringify(item))
-					if (item.classes.length) {
-						let isExist = this.classRooms.filter(i => i.id === item.classes[0])
-						this.classType = isExist ? isExist[0].scope : 'private'
-					}
+					// if (item.classes.length) {
+					// 	let isExist = this.classRooms.filter(i => i.id === item.classes[0])
+					// 	this.classType = isExist ? isExist[0].scope : 'private'
+					// }
 				})
 				this.descriptionEditor.txt.html(item.description)
 			},

+ 20 - 7
TEAMModelOS/ClientApp/src/view/learnactivity/CreatePrivEva.vue

@@ -184,6 +184,8 @@ export default {
 
                                 if (res.courses && res.courses.length > 0) {
                                     res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
+                                    //一个名单被安排到不同教室上课会出现重复数据,这里需要去重
+                                    let list = []
                                     res.courses[0].schedule.forEach(item => {
                                         // 补充教室信息
                                         if (item.classId) {
@@ -192,7 +194,7 @@ export default {
                                             })
                                             item.classInfo = {
                                                 id: item.classId,
-                                                name: classInfo ? `${classInfo.name}` : ' - -'
+                                                name: classInfo ? classInfo.name : '(此班已被删除)'
                                             }
                                         }
                                         // 补充名单信息
@@ -200,14 +202,25 @@ export default {
                                             let listInfo = _this.stuList.find(listItem => {
                                                 return listItem.id == item.stulist
                                             })
-                                            item.listName = listInfo ? `${listInfo.name}` : ' - -'
+                                            item.listName = listInfo ? listInfo.name : '(名单已被删除)'
+                                        }
+                                        //统一数据格式
+                                        item.classId = item.classId || undefined
+                                        item.stulist = item.stulist || undefined
+                                        // 一个名单被安排到不同教室上课会出现重复数据,这里做去重操作
+                                        let has = list.find(listItem => {
+                                            return listItem.classId == item.classId && item.stulist == listItem.stulist
+                                        })
+                                        if (!has) {
+                                            list.push(item)
                                         }
                                     })
+
+                                    res.courses[0].teaClasses = list.filter(item => {
+                                        return item.classId || item.stulist
+                                    })
                                 }
-                                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 => {
+                                let nodes = res.courses[0].teaClasses.map(item => {
                                     return {
                                         value: item.stulist || item.classId,
                                         label: item.listName || item.classInfo.name,
@@ -294,7 +307,7 @@ export default {
             mode: '',
             selectBefore: [],
             stuList: [],
-			showBack:false
+            showBack: false
         }
     },
     methods: {

+ 13 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/Scoring.vue

@@ -41,6 +41,9 @@
                             <span style="color:#2db7f5;" v-else>{{row.data[qIndex]}}</span>
                         </div>
                     </template>
+                    <template slot-scope="{ row }" slot="total">
+                        <span style="color:#2db7f5;">{{ getTotalScore(row.data)}}</span>
+                    </template>
                     <!-- 1: 未作答 2:未评分 3:已评分 -->
                     <template slot-scope="{ row,index }" slot="status">
                         <span class="stu-status-tag" @click="getStuScore(row,0)" :style="{'background':row.status == 1 ? '#c5c8ce' : row.status == 2 ? '#ff9900' : '#19be6b', 'cursor':row.status == 1 ? 'text':'pointer'}">
@@ -117,7 +120,7 @@ export default {
                 },
                 {
                     title: this.$t('learnActivity.score.column2'),
-                    key: "total",
+                    slot: "total",
                     align: "center",
                     sortable: true,
                     fixed: "right",
@@ -140,6 +143,13 @@ export default {
         }
     },
     methods: {
+        getTotalScore(data) {
+            return data.reduce((prev, curr, idx, arr) => {
+                prev = prev < 0 ? 0 : prev
+                curr = curr < 0 ? 0 : curr
+                return prev + curr
+            })
+        },
         // 排序操作
         onSortChange(data) {
             let order = data.order // 当前排序方式 升序、降序、正常
@@ -170,6 +180,7 @@ export default {
             let end = this.pageSize * page
             this.currentPage = page
             this.tableData = this.studentScore.slice(start, end)
+            console.log('表格数据', this.tableData)
         },
         toggleScoreStatus() {
             this.$refs['paperScore'].isComplete = false
@@ -368,7 +379,7 @@ export default {
                 (res) => {
                     if (res.examClassResults) {
                         this.paperInfo[this.chooseClass]["studentAns"] = res.examClassResults[0];
-                        this.setTableData();
+                        this.setTableData()
                         if (res.examClassResults[0]) {
                             this.calcOverView(res.examClassResults[0])
                         }

+ 23 - 15
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -1024,7 +1024,7 @@ export default {
                 }
                 clientId = this.$store.state.config.China.clientID
             }
-            let state = this.$jsFn.getBtwRandom(1000,9999)
+            let state = this.$jsFn.getBtwRandom(1000, 9999)
             let idToken = localStorage.getItem('id_token')
             let tokenData = jwtDecode(idToken)
             let nonce = tokenData ? tokenData.nonce : ''
@@ -1309,7 +1309,7 @@ export default {
                     if (!res.error) {
                         if (res.courses && res.courses.length > 0) {
                             res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
-                            //过滤当前教师的schedule 因为一个名单被安排到不同教室上课会出现重复数据,这里需要去重
+                            //过滤当前教师的schedule 
                             res.courses[0].schedule = res.courses[0].schedule.filter(item => {
                                 return item.teacherId == this.$store.state.userInfo.TEAMModelId
                             })
@@ -1350,6 +1350,8 @@ export default {
                                     this.$Message.error('API ERROR')
                                 }
                             }
+                            //一个名单被安排到不同教室上课会出现重复数据,这里需要去重
+                            let list = []
 
                             res.courses[0].schedule.forEach(item => {
                                 //补充教室信息
@@ -1359,12 +1361,11 @@ export default {
                                     })
                                     item.classInfo = {
                                         id: item.classId,
-                                        name: classInfo ? classInfo.name : '--'
+                                        name: classInfo ? classInfo.name : '(此班已被删除)'
                                     }
                                     //根据上面查看班级学生的返回结果补充学生名单
                                     if (classStus && classStus.stus) {
                                         classStus.stus.forEach(stuItem => {
-                                            console.log('填充学生数据')
                                             if (stuItem.length > 0 && stuItem[0].classId == item.classId) {
                                                 item.students = stuItem
                                                 item.fullStu = true
@@ -1378,18 +1379,25 @@ export default {
                                     let listInfo = this.stuList.find(listItem => {
                                         return listItem.id == item.stulist
                                     })
-                                    item.listName = listInfo ? listInfo.name : '--'
+                                    item.listName = listInfo ? listInfo.name : '(名单已被删除)'
                                     item.students = listInfo ? listInfo.students : []
                                     item.fullStu = false
                                 }
+                                //统一数据格式
+                                item.classId = item.classId || undefined
+                                item.stulist = item.stulist || undefined
+                                // 一个名单被安排到不同教室上课会出现重复数据,这里做去重操作
+                                let has = list.find(listItem => {
+                                    return listItem.classId == item.classId && item.stulist == listItem.stulist
+                                })
+                                if (!has) {
+                                    list.push(item)
+                                }
                             })
+                            res.courses[0].teaClasses = list
                         }
                         this.$set(this.courseListShow, this.curCusIndex, res.courses[0])
-                        console.log(this.courseListShow[this.curCusIndex])
                         this.changeClassroom(0)
-                        // if (sessionStorage.getItem('myCusTabName') && sessionStorage.getItem('myCusTabName') != 'record') {
-                        //     this.selectTab(sessionStorage.getItem('myCusTabName'))
-                        // }
                     }
                 }
             ).finally(() => {
@@ -1476,13 +1484,13 @@ export default {
                 return true
             }
         },
-        //课程名单 —— schedule
+        //课程名单 —— 去重处理后的数据
         teaClassList() {
-            if (this.courseListShow.length > 0 && this.courseListShow[this.curCusIndex] && this.courseListShow[this.curCusIndex].schedule) {
-                let list = this.courseListShow[this.curCusIndex].schedule.filter(item => {
-                    return item.teacherId == this.$store.state.userInfo.TEAMModelId && (item.classId || item.stulist)
-                })
-                return list
+            if (this.courseListShow.length > 0 && this.courseListShow[this.curCusIndex]) {
+                // let list = this.courseListShow[this.curCusIndex].schedule.filter(item => {
+                //     return item.teacherId == this.$store.state.userInfo.TEAMModelId && (item.classId || item.stulist)
+                // })
+                return this.courseListShow[this.curCusIndex].teaClasses || []
             } else {
                 return []
             }

+ 2 - 0
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue

@@ -231,6 +231,8 @@
 					this.isEmptyData = false;
 					this.$refs.qnForm.qnFormEdit = true;
 					this.onChangeResultTab('result')
+					this.$refs.qnForm.classNameArr = []
+					this.$EventBus.$emit('onCreateVote')
 				}
 			},
 

+ 2 - 0
TEAMModelOS/ClientApp/src/view/vote/ManageVote.vue

@@ -198,6 +198,8 @@
 					this.editable = true
 					this.hasNewAdd = true
 					this.$refs.voteForm.voteFormEdit = true
+					this.$refs.voteForm.classNameArr = []
+					this.$EventBus.$emit('onCreateVote')
 				}
 
 				this.$nextTick(() => {

+ 6 - 5
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -1167,10 +1167,10 @@ namespace TEAMModelOS.Controllers
                         }
                     }
                 }
-                List<List<string>> stuAns = new List<List<string>>();
-                List<List<double>> stuScore = new List<List<double>>();
-                List<List<string>> mark = new List<List<string>>();
-                List<double> total = new List<double>();
+                List<List<string>> stuAns = new();
+                List<List<double>> stuScore = new();
+                List<List<List<Details>>> mark = new();
+                List<double> total = new();
                 if (answers.Count > 0)
                 {
                     foreach (ExamClassResult result in answers)
@@ -1184,7 +1184,8 @@ namespace TEAMModelOS.Controllers
                         stuScore.Add(result.studentScores[index]);
                         if (result.mark.Count > 0)
                         {
-                            mark.Add(result.mark[index]);
+                            mark = result.mark;
+                            //mark.Add(result.mark[index]);
                         }
                         total.Add(result.sum.Where(s => s <= 59).Count());
                         total.Add(result.sum.Where(s => s > 59 && s <= 70).Count());

+ 35 - 8
TEAMModelOS/Controllers/Teacher/CommentController.cs

@@ -18,6 +18,7 @@ using Microsoft.Extensions.Options;
 using System.Text;
 using Azure.Messaging.ServiceBus;
 using Microsoft.Extensions.Configuration;
+using System.Linq;
 
 namespace TEAMModelOS.Controllers
 {
@@ -151,6 +152,7 @@ namespace TEAMModelOS.Controllers
             if (!request.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
             if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
             if (!request.TryGetProperty("classId", out JsonElement classId)) return BadRequest();
+            if (!request.TryGetProperty("index", out JsonElement itemIndex)) return BadRequest();
             //根据不同评测的类型返回对应的编码
             if (!request.TryGetProperty("code", out JsonElement school)) return BadRequest();
             try
@@ -171,26 +173,51 @@ namespace TEAMModelOS.Controllers
                     }
                 }
                 ExamClassResult classResult = new ExamClassResult();
-                List<List<string>> ans = answer.ToObject<List<List<string>>>();
+                Details ans = answer.ToObject<Details>();
                 List<List<string>> standard = new List<List<string>>();
                 List<double> points = new List<double>();
                 List<Task<string>> tasks = new List<Task<string>>();
                 foreach (ExamClassResult result in examClassResults)
                 {
                     int index = result.studentIds.IndexOf(studentId.ToString());
-                    StringBuilder builder = new StringBuilder();
+                    /*StringBuilder builder = new StringBuilder();
                     builder.Append(result.examId).Append("/");
                     builder.Append(result.subjectId).Append("/");
                     builder.Append(studentId).Append("mark").Append("/");
                     //builder.Append(tId).Append('/');
                     builder.Append("ans.json");
-                    /*string FileName = result.examId + "/" + result.subjectId + "/" + studentId;
-                    string blob = FileName + "/" + "ans.json";*/
+                    *//*string FileName = result.examId + "/" + result.subjectId + "/" + studentId;
+                    string blob = FileName + "/" + "ans.json";*//*
                     tasks.Add(_azureStorage.UploadFileByContainer(school.ToString(), ans.ToJsonString(), "exam", builder.ToString(), false));
                     //result.studentAnswers[newIndex].Add(builder.ToString());
-                    /*string FileName = result.examId + "/" + result.subjectId + "/" + studentId + "mark";
-                    string blob = await _azureStorage.UploadFileByContainer(school.ToString(), ans.ToJsonString(), "exam", FileName + "/" + "ans.json");*/
-                    //result.studentAnswers[index].Add(blob);
+                    *//*string FileName = result.examId + "/" + result.subjectId + "/" + studentId + "mark";
+                    string blob = await _azureStorage.UploadFileByContainer(school.ToString(), ans.ToJsonString(), "exam", FileName + "/" + "ans.json");*//*
+                    //result.studentAnswers[index].Add(blob);*/
+                    List<Details> details = result.mark[index][itemIndex.GetInt32()];
+                    if (details.Count > 0)
+                    {
+                        List<Details> ds = details.Where(x => x.tmdId.Equals(tId.GetString())).ToList();
+                        if (ds.Count > 0)
+                        {
+                            foreach (Details de in ds)
+                            {
+                                if (de.tmdId.Equals(ans.tmdId))
+                                {
+                                    de.mark = ans.mark;
+                                    de.sc = ans.sc;
+                                    de.index = ans.index;
+                                }
+                            }
+                        }
+                        else {
+                            result.mark[index][itemIndex.GetInt32()].Add(ans);
+                        }
+                    }
+                    else {
+                        result.mark[index][itemIndex.GetInt32()].Add(ans);
+                    }
+                    
+                    /*result.mark[index][itemIndex.GetInt32()].Add(ans);
                     if (result.mark == null || result.mark.Count == 0)
                     {
                         List<List<string>> annotation = new List<List<string>>();
@@ -200,7 +227,7 @@ namespace TEAMModelOS.Controllers
                         }
                         result.mark = annotation;
                     }
-                    result.mark[index].Add(builder.ToString());
+                    result.mark[index].Add(builder.ToString());*/
                     classResult = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(result, result.id, new PartitionKey($"{result.code}"));
                 }
                 await Task.WhenAll(tasks);