| 
					
				 | 
			
			
				@@ -61,11 +61,12 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <div class="tableWrap"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-table 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         :data="tableList" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ref="multipleTable" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ref="multipleSelection" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         :header-cell-style="{ background: '#EDEEF0', color: '#444' }" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         @selection-change="handleSelectionChange" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        @select="onTableSelect" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <el-table-column type="selection"  width="55" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-table-column type="selection" width="55" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-table-column 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           align="center" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           prop="id" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -125,10 +126,11 @@ import { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } from "./api"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { courseEmnuList, jobNature } from "@/utils/searchArray"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { teacherQueryPage } from "@/api/teacherManager"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import deepClone from "@/helpers/deep-clone/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: "add-courseware", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   components: { pagination }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  props: ['list'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  props: ["list"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   data() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       jobNature, // 工作类型 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -151,6 +153,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async mounted() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.activeChiose = this.list || []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     await this.$store.dispatch("setBranchs"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.getList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -163,9 +166,40 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$refs.searchForm.resetFields(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.search(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    handleSelectionChange(val) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(val, 'val') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.activeChiose = val; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    onTableSelect(arr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let currentPageList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const otherPageList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.activeChiose.forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (item.currentPage == this.pageInfo.page) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            currentPageList.push(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            otherPageList.push(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const lastPage = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (arr.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          arr.forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const index = currentPageList.findIndex( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              child => child.id === item.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (index === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              lastPage.push(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          currentPageList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.activeChiose = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          ...lastPage, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          ...otherPageList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          ...currentPageList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ].sort((a, b) => a.id - b.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } catch (e) {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleSelectionChange(arr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // console.log(val, 'val') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async getList() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -178,21 +212,35 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         teacherQueryPage(params).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (res.code == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //  (res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            console.log(res, 'data') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.tableList = res.data.rows; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log(res, "data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const rows = res.data.rows || []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            rows.forEach(row => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              row.currentPage = this.pageInfo.page; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.tableList = rows; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.pageInfo.total = res.data.total; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 反选对应数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            console.log(this.list, 'this.list') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const activeChiose = deepClone(this.activeChiose); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log(activeChiose, "this.list"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.$nextTick(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.tableList.forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const index = this.list.findIndex(child => child.id === item.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                console.log(index, 'tableList') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(index > -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  this.$refs.multipleTable.toggleRowSelection(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const index = activeChiose.findIndex( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  child => child.id == item.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (index > -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  console.log(index, "tableList", item.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  this.activeChiose[index].currentPage = item.currentPage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  this.$refs.multipleSelection.toggleRowSelection(item, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //     this.tableList.forEach(course => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //   if (idList.indexOf(course.skuStockId) != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //     this.$refs.multipleSelection.toggleRowSelection(course, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } catch { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -200,16 +248,15 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async onSubmit() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const userList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const userList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.activeChiose.forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         userList.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          name: item.realName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          name: item.realName || item.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           id: item.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(userList, 'this.activeChiose') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.$emit('confirm', userList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log(userList, "this.activeChiose"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$emit("confirm", userList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$emit("close"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 |