Browse Source

修改组件rolelist参数

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

+ 8 - 8
src/components/rolelist/index.vue

@@ -87,7 +87,7 @@ export default {
       type: String,
       default: "",
     },
-    GroupIds:{
+    GroupIds: {
       type: Array,
       default: () => [],
     },
@@ -115,7 +115,7 @@ export default {
     roleType: {
       handler (msg) {
         if (msg == 'account') {
-          this.getRoleData('UserId');
+          this.getRoleData('UserId', 'UserName');
         }
         if (msg == 'roleByUpId') {
 
@@ -188,7 +188,7 @@ export default {
       this.checkList = datas;
     },
     //获取列表
-    async getRoleData (ids) {
+    async getRoleData (ids, names) {
       try {
         this.loading = true;
         const obj = {
@@ -207,7 +207,7 @@ export default {
           const arrs = this.arrsList.flat();
           const msgs = _.unionBy(arrs, ids);
           msgs.forEach(item => {
-            item.name = item.UserName
+            item.name = item[names]
           });
           this.dataList = msgs;
           this.total = num;
@@ -227,15 +227,15 @@ export default {
       try {
         this.loading = true;
         const obj = {
-          GroupIds:this.GroupIds
+          GroupIds: this.GroupIds
         };
         let result = null;
-        if(this.roleType == 'roleByUpId'){
+        if (this.roleType == 'roleByUpId') {
           result = await GetRoleByGroup(obj);
         }
         if (result.code === 0) {
           const datas = result.returnData;
-          this.dataList=datas;
+          this.dataList = datas;
           this.dataList.forEach(item => {
             item.name = item.RoleName
           });
@@ -254,7 +254,7 @@ export default {
     load () {
       this.pageNum += 1;
       if (this.roleType == 'account') {
-        this.getRoleData('UserId');
+        this.getRoleData('UserId', 'UserName');
       }
     }
   },