فهرست منبع

修改学生管理

11wqe1 1 ماه پیش
والد
کامیت
e0b789ab77

+ 63 - 18
src/components/pages/studentManageNew/component/addstu.vue

@@ -169,9 +169,12 @@
                 >{{ lang.ssDownloadTemp }}</span
               >
             </div>
-            <div style="margin-top: 10px">
+            <div v-if="boxType == 0" style="margin-top: 10px">
               {{ lang.ssUploadNote }}
             </div>
+            <div v-else style="margin-top: 10px">
+              {{ lang.ssSyncImportClassInfo }}
+            </div>
             <!-- <div style="margin-top: 10px">
               学生列表批量上传需表格需添加“班级”列
             </div> -->
@@ -433,7 +436,7 @@ export default {
         var wb; //读取完成的数据
         var outdata;
         var reader = new FileReader();
-        reader.onload = function (e) {
+        reader.onload = async function (e) {
           var bytes = new Uint8Array(reader.result);
           var length = bytes.byteLength;
           for (var i = 0; i < length; i++) {
@@ -473,7 +476,7 @@ export default {
               } else {
                 obj.mail = uuidv4() + "@" + _this.userSuffix;
               }
-              obj.class = _this.boxType == 2 ? v[_this.lang.Class] : _this.classInfo.name;
+              obj.class = _this.boxType == 2 ? v[_this.lang.Class] : _this.classInfo.id;
               arr.push(obj);
             }else{
               _this.$message.error(_this.lang.ssCheckStuNameCol);
@@ -481,22 +484,35 @@ export default {
             }
           });
           console.log(arr);
-          // if (arr.length > 70) {
-          //   _this.$message.error(_this.lang.Limitmore);
-          //   return;
-          // }
-
-          if (this.boxType == 2 && arr.filter(e => e.class) != arr.length) {
-            _this.$message.error(_this.lang.ssCheckClassCol);
-            return;
-          }
-
           if (!arr.length) {
             _this.$message.error(
               _this.lang.ssParseStuFail
             );
             return;
           }
+         
+          if (_this.boxType == 2) {
+            let stuClassInfo = await _this.getClassInfo();
+            console.log(stuClassInfo, "stuClassInfo");
+            arr.forEach((e) => {
+              let classInfo = stuClassInfo.find(item => item.name == e.class);
+              if (classInfo) {
+                e.class = classInfo.id;
+              } else {
+                e.class = '';
+              }
+            });
+          }
+          console.log(arr, "arr");
+          
+         
+
+          if (_this.boxType == 2 && arr.filter(e => e.class).length !== arr.length) {
+            _this.$message.error(_this.lang.ssCheckClassCol);
+            return;
+          }
+
+          
           _this.deltypy = 1;
           _this.popBoxdia= true;
           _this.stuexcel = arr;
@@ -511,6 +527,37 @@ export default {
         reader.readAsBinaryString(f);
       }
     },
+    async getClassInfo() {
+      return new Promise((resolve, reject) => {
+        let params = {
+          oid: this.oid,
+        };
+        this.ajax
+          .get(this.$store.state.api + "selectGradeNew", params)
+          .then((res) => {
+            let box1 = JSON.parse(JSON.stringify(res.data[0]));
+            let box2 = JSON.parse(JSON.stringify(res.data[1]));
+          
+            // box1.push({id:0,name:this.lang.ssInterestClass});
+
+            const gradeIds = box1.filter(e => e.id !== 0).map(e => e.id);
+
+            let box3 = [];
+
+            box2.forEach((e) => {
+              if (gradeIds.includes(e.pid)) {
+                e.name = box1.find(item => item.id == e.pid).name + e.name;
+                box3.push(e);
+              }
+            });
+            resolve(box3);
+          })
+          .catch((err) => {
+            console.error(err);
+            reject(err);
+          });
+      });
+    },
     // 手动输入添加学生
     addStu() {
       this.selectedStuData = this.selectedStuData.filter((item) => item != "");
@@ -550,15 +597,13 @@ export default {
       if (this.boxType == 2) {
         classInfo = this.cascaderData.flatMap((item) => item.children).filter((item) => this.cascaderDataPath[1]==item.id)[0];
       }
-      // console.log(classInfo, "classInfo");
       let box = this.selectedStuData.map((item) => {
         return {
           name: item,
           mail: uuidv4() + mail,
-          class: classInfo.name,
+          class: classInfo.id,
         };
       });
-      // console.log(box, "box");
 
       this.accUpdate(box);
     },
@@ -606,10 +651,10 @@ export default {
             oid: this.oid,
           },
         ];
-      console.log(params, "batchRegistrationMoreCopy");
+      console.log(params, "batchRegistrationMoreCopyNew");
       // batchRegistrationMoreCopy
         this.ajax
-          .post(this.$store.state.api + "batchRegistrationMoreCopy", params)
+          .post(this.$store.state.api + "batchRegistrationMoreCopyNew", params)
           .then((res) => {
             console.log(res, "res");
             if (res.data.type == 1) {

+ 5 - 5
src/components/pages/studentManageNew/component/table.vue

@@ -204,7 +204,7 @@
         <el-table-column
           v-for="(item, index) in tableColumns"
           :key="index"
-          :width="item.wid"
+          :min-width="item.wid"
           show-overflow-tooltip
           :label="item.label"
         >
@@ -786,9 +786,9 @@ export default {
     },
     studentColumns() {
       return [
-        { label: this.lang.StudentName, prop: "username" },
-        { label: this.lang.Account, prop: "acc" },
-        { label: this.lang.Class, prop: "classname", wid: "360" }
+        { label: this.lang.StudentName, prop: "username",wid:'30%' },
+        { label: this.lang.Account, prop: "acc",wid:'30%' },
+        { label: this.lang.Class, prop: "classname" }
       ];
     },
     tableInterestClaColumns() {
@@ -1419,7 +1419,7 @@ export default {
       console.log(params);
 
       this.ajax
-        .post(this.$store.state.api + "addClassgra", params)
+        .post(this.$store.state.api + "addClassgraNew", params)
         .then(res => {
           if (res.data[0] && res.data[0][0].classname == 1) {
             this.$message({

+ 1 - 1
src/components/pages/studentManageNew/index.vue

@@ -508,7 +508,7 @@ export default {
       console.log(params);
 
       this.ajax
-        .post(this.$store.state.api + "addClassgra", params)
+        .post(this.$store.state.api + "addClassgraNew", params)
         .then((res) => {
           if (res.data[0] && res.data[0][0].classname == 1) {
             this.$message({

+ 4 - 2
src/lang/cn.json

@@ -2008,11 +2008,11 @@
   "ssUploadTip":"支持格式:.xlsx,.xls,大小不超过10MB",
   "ssUploadTempLbl":"上传模板:",
   "ssDownloadTemp":"下载模板",
-  "ssUploadNote":"注意:请按照模板格式填写学生信息,避免导入失败",
+  "ssUploadNote":"提示:请按照模板格式填写学生信息并导入。",
   "ssGetSuffixReUp":"正在获取后缀,请重新上传",
   "ssGetSuffixReAdd":"正在获取后缀,请重新添加",
   "ssCheckStuNameCol":"请检查上传文件学生姓名列是否填写正确",
-  "ssCheckClassCol":"请检查上传文件班级列是否填写正确",
+  "ssCheckClassCol":"有同学班级信息有误,请检查",
   "ssParseStuFail":"未能提取上传学生信息,请检查数据格式,使用模板文件格式上传",
   "ssEnterStu":"请输入学生",
   "ssAddStuMax70":"一次最多添加70人",
@@ -2044,5 +2044,7 @@
   "ssSelectCourseType":"请选择课程类型",
   "ssSelectedCourse":"已选择 * 个课程",
   "ssSelectedApp":"已选择 * 个应用",
+  "ssSyncImportClassInfo":"提示: 如需同步导入班级信息,请于此处下载导入模板,并于【班级】列准确输入年级+班级名称作为学生班级(兴趣班不支持导入学生)"
+,
   "ssNoSettingAnswer":"未设置正确答案"
 }

+ 5 - 3
src/lang/en.json

@@ -2007,11 +2007,11 @@
   "ssUploadTip":"Supported: xlsx, xls , up to 10MB",
   "ssUploadTempLbl":"Upload template:",
   "ssDownloadTemp":"Download template",
-  "ssUploadNote":"Note: Please fill in student information according to the template format to avoid import failure",
+  "ssUploadNote":"Tip: Please fill in student information according to the template format to avoid import failure",
   "ssGetSuffixReUp":"Getting suffix, please re-upload",
   "ssGetSuffixReAdd":"Getting suffix, please re-add",
   "ssCheckStuNameCol":"Please check whether the student name column in the uploaded file is correct",
-  "ssCheckClassCol":"Please check whether the class column in the uploaded file is correct",
+  "ssCheckClassCol":"Some students have incorrect class information, please check",
   "ssParseStuFail":"Failed to parse student information. Please check the data format and use the template file format",
   "ssEnterStu":"Please enter student",
   "ssAddStuMax70":"You can add up to 70 students at a time",
@@ -2043,6 +2043,8 @@
   "ssSelectCourseType":"Please select course type",
   "ssSelectedCourse":"Selected * courses",
   "ssSelectedApp":"Selected * apps",
-  "ssNoSettingAnswer":"No correct answer set"
+  "ssNoSettingAnswer":"No correct answer set",
+  "ssSyncImportClassInfo":"Tip: If you need to synchronize import class information, please download the import template here, and accurately enter the grade + class name as the student class in the [Class] column (interest classes do not support importing students)"
+
 
 }

+ 4 - 4
src/lang/hk.json

@@ -2007,11 +2007,11 @@
   "ssUploadTip":"支持格式:.xlsx,.xls,大小不超過10MB",
   "ssUploadTempLbl":"上傳模板:",
   "ssDownloadTemp":"下載模板",
-  "ssUploadNote":"注意:請按照模板格式填寫學生信息,避免導入失敗",
+  "ssUploadNote":"提示:請按照模板格式填寫學生信息,避免導入失敗",
   "ssGetSuffixReUp":"正在獲取後綴,請重新上傳",
   "ssGetSuffixReAdd":"正在獲取後綴,請重新添加",
   "ssCheckStuNameCol":"請檢查上傳文件學生姓名列是否填寫正確",
-  "ssCheckClassCol":"請檢查上傳文件班級列是否填寫正確",
+  "ssCheckClassCol":"有同學班級信息有誤,請檢查",
   "ssParseStuFail":"未能提取上傳學生信息,請檢查數據格式,使用模板文件格式上傳",
   "ssEnterStu":"請輸入學生",
   "ssAddStuMax70":"一次最多添加70人",
@@ -2044,6 +2044,6 @@
   "ssSelectedCourse":"已選擇 * 個課程",
   "ssSelectedApp":"已選擇 * 個應用",
   "ssCocoNoteUpdateTips":"協同建構不支持修改基本信息,只支持加入分組。",
-  "ssNoSettingAnswer":"未設置正確答案"
-
+  "ssNoSettingAnswer":"未設置正確答案",
+  "ssSyncImportClassInfo":"提示: 如需同步導入班級信息,請於此處下載導入模板,並於【班級】列準確輸入年級+班級名稱作為學生班級(興趣班不支持導入學生)"
 }