作者 严俊东
提交者 Gitee

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

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