| 
					
				 | 
			
			
				@@ -38,7 +38,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <span :style="{ marginLeft: '4px' }">用户列表</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-col :span="12" :style="{ textAlign: 'right' }"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-button size="mini" plain icon="el-icon-plus"> 添加 </el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            size="mini" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            plain 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            icon="el-icon-plus" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @click="openDialog()" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            添加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </el-row> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </div> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,6 +93,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             icon="el-icon-edit" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             circle 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             size="mini" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @click="openDialog(row.id)" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           ></el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-popconfirm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             confirm-button-text="确认" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -110,25 +118,41 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <el-row :style="{ marginTop: '16px' }"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-col :span="24" :style="{ textAlign: 'right' }"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-pagination 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :current-page="page" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           :page-size="10" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           layout="total, prev, pager, next" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          :total="400" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :total="total" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          small 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          @current-change="onCurrentChange" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </el-pagination> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-row> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <el-dialog 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      :title="editUserID ? '修改用户' : '新增用户'" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      :visible.sync="dialogVisible" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      width="40%" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      @close="resetDialog" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      center 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <UserEdit :id="editUserID" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </el-dialog> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { mapActions, mapState } from 'vuex'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { mapActions, mapState, mapGetters } from 'vuex'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { getAllRoles } from '@/api/roles'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { deleteUser } from '@/api/users'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import UserEdit from './components/UserEdit.vue'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: 'Users', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   data() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      dialogVisible: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      editUserID: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       filterName: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       roles: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -141,8 +165,23 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   computed: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ...mapState('users', ['users', 'pageInfo']), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ...mapGetters('users', ['total', 'page']), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    resetDialog() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.editUserID = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    openDialog(id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // if (id) this.editUserID = id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      id && (this.editUserID = id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.dialogVisible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 页码变化时 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    onCurrentChange(pno) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // console.log(`output->pno`, pno); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$store.commit('users/setPage', { pno }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.loadData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 删除用户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async onDeleteUser(id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // console.log(`output->id`, id); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -180,6 +219,9 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.roles = data.list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  components: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    UserEdit, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |