sunlupeng 1 vuosi sitten
vanhempi
commit
048ea57633
1 muutettua tiedostoa jossa 22 lisäystä ja 17 poistoa
  1. 22 17
      src/views/system/user/index.vue

+ 22 - 17
src/views/system/user/index.vue

@@ -259,23 +259,28 @@ export default {
     /** 分配角色操作 */
     handleRole(row) {
       this.reset();
-      const id = row.id
-      // 处理了 form 的 name 和 name 的展示
-      this.form.id = id;
-      this.form.name = row.name;
-      // 打开弹窗
-      this.openRole = true;
-      // 获得角色列表
-      listSimpleRoles().then(response => {
-        // 处理 roleOptions 参数
-        this.roleOptions = [];
-        this.roleOptions.push(...response.data);
-      });
-      // 获得角色拥有的菜单集合
-      listUserRoles(id).then(response => {
-        // 设置选中
-        this.form.roleIds = response.data;
-      })
+      const id = row.userId;
+      if(id){
+        // 处理了 form 的 name 和 name 的展示
+        this.form.id = id;
+        this.form.name = row.name;
+        // 打开弹窗
+        this.openRole = true;
+        // 获得角色列表
+        listSimpleRoles().then(response => {
+          // 处理 roleOptions 参数
+          this.roleOptions = [];
+          this.roleOptions.push(...response.data);
+        });
+        // 获得角色拥有的菜单集合
+        listUserRoles(id).then(response => {
+          // 设置选中
+          this.form.roleIds = response.data;
+        })
+      }else{
+        this.$modal.msgWarning("该员工尚未注册账号,暂时无法分配角色!");
+      }
+      
     },
 
     /** 提交按钮(角色权限) */