11wqe1 преди 8 месеца
родител
ревизия
4144d2a2e1
променени са 1 файла, в които са добавени 22 реда и са изтрити 2 реда
  1. 22 2
      src/components/pages/testPerson/info/infoDialog/index.vue

+ 22 - 2
src/components/pages/testPerson/info/infoDialog/index.vue

@@ -75,7 +75,7 @@ export default {
         dialogVisibleInfo(newVal) {
             if (newVal) {
                 this.getClass2();
-                this.getData();
+
             }
         }
     },
@@ -144,12 +144,31 @@ export default {
                 .then((res) => {
                     this.info = res.data[0][0]
                     this.info.teacherOffice = []
-                    this.info.teacherOffice = this.info.cclassid.split(',')
+                    let array = []
+                    for(var i = 0; i < this.classJuri.length; i++){
+                        array.push(this.classJuri[i].id)
+                    }
+                    this.info.teacherOffice = this.arrayToArray(this.info.cclassid.split(','), array)
                 })
                 .catch((err) => {
                     console.error(err);
                 });
         },
+        arrayToArray(arrayo, arrayt) {
+            let array1 = arrayo;
+            let array2 = arrayt;
+
+            let commonElements = [];
+
+            for (let i = 0; i < array1.length; i++) {
+                for (let j = 0; j < array2.length; j++) {
+                if (array1[i] === array2[j]) {
+                    commonElements.push(array1[i]);
+                }
+                }
+            }
+            return commonElements;
+        },
         addImg(e) {
             var el = e.currentTarget;
             el.getElementsByTagName("input")[0].click();
@@ -232,6 +251,7 @@ export default {
                 .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
                 .then((res) => {
                     this.classJuri = res.data[0];
+                    this.getData();
                 })
                 .catch((err) => {
                     this.isLoading = false;