CrazyIter_Bin vor 4 Jahren
Ursprung
Commit
54e451283b

+ 1 - 1
TEAMModelOS/ClientApp/src/view/student-account/ClassMgt.vue

@@ -294,7 +294,7 @@ export default {
                     { required: true, message: this.$t('schoolBaseInfo.typeWarning'), trigger: 'change' }
                 ],
                 year: [
-                    { required: true, message: this.$t('schoolBaseInfo.gradeWarning'), trigger: 'change' }
+                    { required: true, type:Number, message: this.$t('schoolBaseInfo.gradeWarning'), trigger: 'change' }
                 ]
             }
         }

+ 3 - 0
TEAMModelOS/ClientApp/src/view/student-account/ImportStudent.vue

@@ -390,6 +390,9 @@ export default {
                 //整理TtableData
                 let temp = this.tableData.map((item) => {
                     item.classNo = item.classId
+                    item.year = parseInt(item.year)
+                    item.classYear = parseInt(item.classYear)
+                    item.year = parseInt(item.year)
                     delete item.classId
                     delete item._disabled
                     delete item.schoolCode

+ 21 - 17
TEAMModelOS/ClientApp/src/view/student-account/Index.vue

@@ -611,24 +611,28 @@ export default {
         baseFindStudent(params) {
             this.$api.stuAccount.findStudent(this.$store.state.user.schoolCode).then(
                 res => {
-                    this.tableLoading = false
-                    // 給一個 PW 讓AddStudent.vue 的Watch 可以動作
-                    let newStudents = res.students.map(function (item) {
-                        let temp = item
-                        temp.pw = '******'
-                        return temp
-                    })
+                    if (res && res.students) {
+                        this.tableLoading = false
+                        // 給一個 PW 讓AddStudent.vue 的Watch 可以動作
+                        let newStudents = res.students.map(function (item) {
+                            let temp = item
+                            temp.pw = '******'
+                            return temp
+                        })
 
-                    newStudents.forEach(element => {
-                        Object.defineProperty(element, 'isGivenAuth', {
-                            value: this.aclassOneInfoNum != undefined && (this.aclassOneInfoNum.staIds.includes(element.id) == true || this.aclassOneInfoNum.dyncIds.includes(element.id)) == true,
-                            writable: true
+                        newStudents.forEach(element => {
+                            Object.defineProperty(element, 'isGivenAuth', {
+                                value: this.aclassOneInfoNum != undefined && (this.aclassOneInfoNum.staIds.includes(element.id) == true || this.aclassOneInfoNum.dyncIds.includes(element.id)) == true,
+                                writable: true
+                            })
                         })
-                    })
-                    //console.log(newStudents);
-                    //Louise Mock加一個授權狀態
-                    this.$store.dispatch('schoolBaseInfo/setStudentsToState', newStudents)
-                    this.filterData()
+                        //console.log(newStudents);
+                        //Louise Mock加一個授權狀態
+                        this.$store.dispatch('schoolBaseInfo/setStudentsToState', newStudents)
+                        this.filterData()
+                    }else{
+                        console.log('返回学生数据异常')
+                    }
                 },
                 err => {
                     this.tableLoading = false
@@ -698,7 +702,7 @@ export default {
                 this.tableShowData = data.slice(0, this.basicCount)
                 return
             }
-            
+
 
             // 帳號資訊搜尋
             if (this.searchText) {

+ 13 - 12
TEAMModelOS/Controllers/School/StudentController.cs

@@ -212,12 +212,14 @@ namespace TEAMModelOS.Controllers
                         }
 
                         //有給classNo才會紀錄className,classNo屬於實體教室門牌號,全校理當只會有一個。 
+                        string year = "";
+                        if (student.TryGetProperty("classYear", out var tmpClassYear) && !string.IsNullOrWhiteSpace(tmpClassYear.GetString()))
+                        {
+                            year = tmpClassYear.GetString();
+                        }
                         if (student.TryGetProperty("className", out var tmpClassName) && !string.IsNullOrWhiteSpace(tmpClassName.GetString()))
                         {
-                            int  year =0;
-                            if (student.TryGetProperty("classYear", out var tmpClassYear) && tmpClassYear.TryGetInt32(out int tmpcsYear)) {
-                                year = tmpcsYear;
-                            }
+                           
                             studentInfo.className = tmpClassName.GetString();
                             if (!dicClassInfo.ContainsKey(tmpClassNo.GetString()))
                             { dicClassInfo.Add(tmpClassNo.GetString(), (tmpClassName.GetString(), studentInfo.periodId, studentInfo.gradeIndex, year)); }
@@ -279,15 +281,14 @@ namespace TEAMModelOS.Controllers
                     {
                         string gradeId = string.Empty;
                         string periodId = string.Empty;
-                        int year = 0;
+                        string year = string.Empty;
                         //確認該學段存在及輸入的年級index正確(-1後大於等於0)
-                        if (gradesInfo.ContainsKey(sortedImpData.classInfo[item].periodId) && sortedImpData.classInfo[item].gradeIndex - 1>=0)
-                        {
-                            periodId = sortedImpData.classInfo[item].periodId;
-                            year = sortedImpData.classInfo[item].year;
-                            gradeId = gradesInfo[sortedImpData.classInfo[item].periodId][sortedImpData.classInfo[item].gradeIndex - 1].gradeId;
-                        }
-
+                        //if (gradesInfo.ContainsKey(sortedImpData.classInfo[item].periodId) && sortedImpData.classInfo[item].gradeIndex - 1>=0)
+                       // {
+                           // periodId = sortedImpData.classInfo[item].periodId;
+                           
+                            //gradeId = gradesInfo[sortedImpData.classInfo[item].periodId][sortedImpData.classInfo[item].gradeIndex - 1].gradeId;
+                        //}
                         //建立新教室
                         (string classId, string classNo, string className, string periodId, string gradeId) retCreateClassInfo = 
                         await createClassInfo(