[代码完善](v2.5): v2.5 beta 修复角色管理中分配菜单后子菜单丢失的问题
问题:角色管理中的分配菜单由于是懒加载的,导致保存分配的菜单时只保存了选择的父节点 修复:在保存前先将部分菜单加载出来 2.5 Beta 详情:https://www.ydyno.com/archives/1225.html
This commit is contained in:
@@ -9,7 +9,7 @@ export function getDepts(params) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getSuperior(ids) {
|
||||
export function getDeptSuperior(ids) {
|
||||
const params = {
|
||||
ids: ids
|
||||
}
|
||||
@@ -43,4 +43,4 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getDepts, getSuperior }
|
||||
export default { add, edit, del, getDepts, getDeptSuperior }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import qs from 'qs'
|
||||
|
||||
export function getMenusTree(pid) {
|
||||
return request({
|
||||
@@ -15,9 +16,12 @@ export function getMenus(params) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getSuperior(id) {
|
||||
export function getMenuSuperior(ids) {
|
||||
const params = {
|
||||
ids: ids
|
||||
}
|
||||
return request({
|
||||
url: 'api/menus/superior?id=' + id,
|
||||
url: 'api/menus/superior?' + qs.stringify(params, { indices: false }),
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -53,4 +57,4 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getMenusTree, getSuperior, getMenus }
|
||||
export default { add, edit, del, getMenusTree, getMenuSuperior, getMenus }
|
||||
|
||||
@@ -174,7 +174,7 @@ export default {
|
||||
}
|
||||
},
|
||||
getSupDepts(id) {
|
||||
crudDept.getSuperior(id).then(res => {
|
||||
crudDept.getDeptSuperior(id).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren && !obj.children) {
|
||||
obj.children = null
|
||||
|
||||
@@ -221,8 +221,8 @@ export default {
|
||||
}, 100)
|
||||
},
|
||||
getSupDepts(id) {
|
||||
crudMenu.getSuperior(id).then(res => {
|
||||
const children = res.content.map(function(obj) {
|
||||
crudMenu.getMenuSuperior(id).then(res => {
|
||||
const children = res.map(function(obj) {
|
||||
if (!obj.leaf && !obj.children) {
|
||||
obj.children = null
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@
|
||||
|
||||
<script>
|
||||
import crudRoles from '@/api/system/role'
|
||||
import { getDepts, getSuperior } from '@/api/system/dept'
|
||||
import { getMenusTree } from '@/api/system/menu'
|
||||
import { getDepts, getDeptSuperior } from '@/api/system/dept'
|
||||
import { getMenusTree, getMenuSuperior } from '@/api/system/menu'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
@@ -247,6 +247,9 @@ export default {
|
||||
val.menus.forEach(function(data, index) {
|
||||
_this.menuIds.push(data.id)
|
||||
})
|
||||
getMenuSuperior(this.menuIds).then(res => {
|
||||
this.menus = res
|
||||
})
|
||||
}
|
||||
},
|
||||
// 保存菜单
|
||||
@@ -300,7 +303,7 @@ export default {
|
||||
depts.forEach(dept => {
|
||||
ids.push(dept.id)
|
||||
})
|
||||
getSuperior(ids).then(res => {
|
||||
getDeptSuperior(ids).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren && !obj.children) {
|
||||
obj.children = null
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
<script>
|
||||
import crudUser from '@/api/system/user'
|
||||
import { isvalidPhone } from '@/utils/validate'
|
||||
import { getDepts, getSuperior } from '@/api/system/dept'
|
||||
import { getDepts, getDeptSuperior } from '@/api/system/dept'
|
||||
import { getAll, getLevel } from '@/api/system/role'
|
||||
import { getAllJob } from '@/api/system/job'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
@@ -415,7 +415,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getSupDepts(deptId) {
|
||||
getSuperior(deptId).then(res => {
|
||||
getDeptSuperior(deptId).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren && !obj.children) {
|
||||
obj.children = null
|
||||
|
||||
Reference in New Issue
Block a user