Commit d04ec69df4f6e73a99ab70ec6aecf4c48ade4f81

Authored by 严俊东
Committed by Gitee
1 parent bc56aae2

角色权限修改时已有权限未自动勾选异常修复

ruoyi-ui/src/views/system/role/index.vue
... ... @@ -368,16 +368,16 @@ export default {
368 368 },
369 369 /** 根据角色ID查询菜单树结构 */
370 370 getRoleMenuTreeselect(roleId) {
371   - roleMenuTreeselect(roleId).then(response => {
  371 + return roleMenuTreeselect(roleId).then(response => {
372 372 this.menuOptions = response.menus;
373   - this.$refs.menu.setCheckedKeys(response.checkedKeys);
  373 + return response;
374 374 });
375 375 },
376 376 /** 根据角色ID查询部门树结构 */
377 377 getRoleDeptTreeselect(roleId) {
378   - roleDeptTreeselect(roleId).then(response => {
  378 + return roleDeptTreeselect(roleId).then(response => {
379 379 this.deptOptions = response.depts;
380   - this.$refs.dept.setCheckedKeys(response.checkedKeys);
  380 + return response;
381 381 });
382 382 },
383 383 // 角色状态修改
... ... @@ -450,24 +450,30 @@ export default {
450 450 handleUpdate(row) {
451 451 this.reset();
452 452 const roleId = row.roleId || this.ids
453   - this.$nextTick(() => {
454   - this.getRoleMenuTreeselect(roleId);
455   - });
  453 + const roleMenu = this.getRoleMenuTreeselect(roleId);
456 454 getRole(roleId).then(response => {
457 455 this.form = response.data;
458 456 this.open = true;
  457 + this.$nextTick(() => {
  458 + roleMenu.then(res => {
  459 + this.$refs.menu.setCheckedKeys(res.checkedKeys);
  460 + });
  461 + });
459 462 this.title = "修改角色";
460 463 });
461 464 },
462 465 /** 分配数据权限操作 */
463 466 handleDataScope(row) {
464 467 this.reset();
465   - this.$nextTick(() => {
466   - this.getRoleDeptTreeselect(row.roleId);
467   - });
  468 + const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId);
468 469 getRole(row.roleId).then(response => {
469 470 this.form = response.data;
470 471 this.openDataScope = true;
  472 + this.$nextTick(() => {
  473 + roleDeptTreeselect.then(res => {
  474 + this.$refs.dept.setCheckedKeys(res.checkedKeys);
  475 + });
  476 + });
471 477 this.title = "分配数据权限";
472 478 });
473 479 },
... ...