zhaoke 3 years ago
parent
commit
8ea29401da
1 changed files with 23 additions and 31 deletions
  1. 23 31
      src/components/rolelist/index.vue

+ 23 - 31
src/components/rolelist/index.vue

@@ -114,16 +114,9 @@ export default {
       total: "",
       loading: false,
       asyncData: [],
-      OpenGroup: null,
-      OpenAuthData: null
+      msgDatas: []
     };
   },
-  created () {
-    const obj = this.$store.state.app.systemSet;
-    const { OpenGroup, UserOfficerMulti } = typeof obj === "string" ? JSON.parse(obj) : obj; //1是请求角色 0是请求用户
-    this.OpenGroup = OpenGroup;
-    this.OpenAuthData = UserOfficerMulti;
-  },
   watch: {
     radioCheck: {
       handler (num) {
@@ -133,17 +126,9 @@ export default {
     },
     roleType: {
       handler (msg) {
-        if (!this.OpenGroup || this.OpenAuthData) {
-          if (msg == 'account') {
-            this.getRoleData('UserId', 'UserName');
-          }
-          if (msg == "roleByUpId") {
-            this.getRoleDataByUpId("roleId");
-          }
-          if (msg == "onlyRole") {
-            this.getRoleData('RoleId', 'RoleName');
-          }
-        }
+        const obj = {};
+        obj[msg] = msg;
+        this.msgDatas.push(obj);
       },
       deep: true,
     },
@@ -160,17 +145,6 @@ export default {
         if (arr && arr.length) {
           this.asyncData.push(true);
         }
-        // if (this.roleType == "roleByUpId") {
-        //   const datas = [];
-        //   this.dataList.forEach((item, index) => {
-        //     arr.forEach((p) => {
-        //       if (item.RoleId == p.RoleId) {
-        //         datas.push(index);
-        //       }
-        //     });
-        //   });
-        //   this.checkList = datas;
-        // }
       },
       deep: true,
     },
@@ -189,8 +163,26 @@ export default {
     },
     GroupIds: {
       handler () {
-        if (this.OpenGroup || !this.OpenAuthData) {
+        const obj = {};
+        obj['GroupIds'] = 'GroupIds';
+        this.msgDatas.push(obj);
+      },
+      deep: true
+    },
+    msgDatas: {
+      handler (arr) {
+        if (arr && arr.length >= 2) {
           this.getRoleDataByUpId();
+        } else {
+          if (this.roleType == 'account') {
+            this.getRoleData('UserId', 'UserName');
+          }
+          if (this.roleType == "roleByUpId") {
+            this.getRoleDataByUpId("roleId");
+          }
+          if (this.roleType == "onlyRole") {
+            this.getRoleData('RoleId', 'RoleName');
+          }
         }
       },
       deep: true