Browse Source

记录关联不能选自己

yuanyiming 1 year ago
parent
commit
006fea77d7

+ 19 - 3
src/components/pages/kindStudentEva/test/diary.vue

@@ -196,7 +196,7 @@
         :sUserId="userid"
         :termList="termList"
         :weiList="weiList"
-        :studentList="studentList"
+        :studentList="studentListCopy"
         @closePop="closePop"
         @getData="getData"
         @updatePanelB="updatePanelB"
@@ -282,6 +282,8 @@ export default {
       weiList: [],
       // 班级学生数据(包括多个班)
       studentList: [],
+      studentListCopy: [],
+
       // 判断显示查看,修改
       judgeNum: 0,
 
@@ -410,6 +412,7 @@ export default {
         .then(res => {
           this.isLoading = false;
           this.tableData = res.data[0];
+          console.log("this.tableData", this.tableData);
           this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
           // console.log(" 获取筛选数据", res.data[0]);
         })
@@ -466,7 +469,12 @@ export default {
         tname: "",
         type: ""
       };
-
+      this.studentListCopy = [];
+      // 去除自己的名字。不能自己关联自己
+      this.studentListCopy = this.studentList.filter(i => {
+        return i.id !== this.info.userid;
+      });
+     
       // this.AddIsPop = true;
       this.isPop = true;
     },
@@ -514,8 +522,16 @@ export default {
           e.recordImg = e.recordImg.split(",");
         }
       }
+      this.studentListCopy = [];
       this.recordData = e;
-      // console.log('recordData',this.recordData);
+      // 去除自己的名字。不能自己关联自己
+      this.studentListCopy = this.studentList.filter(i => {
+        return i.id !== e.sid;
+      });
+      // this.studentList = res[0].filter(i => {
+      //   return i.id !== allData.sid;
+      // });
+      // console.log("recordData", this.recordData);
       this.$forceUpdate();
       this.isPop = true;
     },

+ 5 - 5
src/components/pages/studentEva.vue

@@ -294,10 +294,10 @@ export default {
       for (var i = 0; i < resList.length; i++) {
         var _json = {};
         _json["姓名"] = resList[i].name;
+        _json["关联同学"] = resList[i].constus;
         _json["班级"] = resList[i].cname;
         _json["记录时间"] = resList[i].recordDate;
         _json["学期"] = resList[i].tName;
-        _json["关联"] = resList[i].constus;
         _json["维度"] = resList[i].VeidooList;
         _json["观察地点"] = resList[i].place;
         _json["观察内容"] = resList[i].recordTit;
@@ -312,11 +312,11 @@ export default {
       let ws = XLSX.utils.json_to_sheet(array); //将json对象数组转化成工作表
       ws["!cols"] = [
         //设置每一列的宽度
-        { wch: 20 },
-        { wch: 30 },
-        { wch: 30 },
-        { wch: 30 },
+        { wch: 10 },
         { wch: 30 },
+        { wch: 10 },
+        { wch: 20 },
+        { wch: 20 },
         { wch: 30 },
         { wch: 30 },
         { wch: 30 },