From fee8a5955b61ce8e880f376c68b03a2ec8ac7dbb Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期一, 02 十二月 2019 09:28:11 +0800
Subject: [PATCH] 若依 2.0

---
 ruoyi-ui/src/views/system/user/index.vue |   31 ++++++++++---------------------
 1 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue
index 760036b..00c3645 100644
--- a/ruoyi-ui/src/views/system/user/index.vue
+++ b/ruoyi-ui/src/views/system/user/index.vue
@@ -290,12 +290,11 @@
 <script>
 import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
 import { treeselect } from "@/api/system/dept";
-import { listPost } from "@/api/system/post";
-import { listRole } from "@/api/system/role";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 
 export default {
+  name: "User",
   components: { Treeselect },
   data() {
     return {
@@ -423,18 +422,6 @@
       this.queryParams.deptId = data.id;
       this.getList();
     },
-    /** 查询岗位列表 */
-    getPosts() {
-      listPost().then(response => {
-        this.postOptions = response.rows;
-      });
-    },
-    /** 查询角色列表 */
-    getRoles() {
-      listRole().then(response => {
-        this.roleOptions = response.rows;
-      });
-    },
     // 用户状态修改
     handleStatusChange(row) {
       let text = row.status === "0" ? "启用" : "停用";
@@ -494,21 +481,23 @@
     handleAdd() {
       this.reset();
       this.getTreeselect();
-      this.getPosts();
-      this.getRoles();
-      this.open = true;
-      this.title = "添加用户";
-      this.form.password = this.initPassword;
+      getUser().then(response => {
+        this.postOptions = response.posts;
+        this.roleOptions = response.roles;
+        this.open = true;
+        this.title = "添加用户";
+        this.form.password = this.initPassword;
+      });
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
       this.getTreeselect();
-      this.getPosts();
-      this.getRoles();
       const userId = row.userId || this.ids
       getUser(userId).then(response => {
         this.form = response.data;
+        this.postOptions = response.posts;
+        this.roleOptions = response.roles;
         this.form.postIds = response.postIds;
         this.form.roleIds = response.roleIds;
         this.open = true;

--
Gitblit v1.9.2