refactor: 去除菜单和部门与角色相关的接口
This commit is contained in:
parent
bd582b8dd9
commit
6395a7c8d4
@ -25,14 +25,6 @@ export function getDeptSelectTree() {
|
||||
});
|
||||
}
|
||||
|
||||
// 根据角色ID查询部门树结构
|
||||
export function getDeptSelectTreeByRole(roleId) {
|
||||
return request({
|
||||
url: `/system/dept/dropdownList/role/${roleId}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
// 新增部门
|
||||
export function addDept(data) {
|
||||
return request({
|
||||
|
||||
@ -25,14 +25,6 @@ export function getMenuSelectTree() {
|
||||
});
|
||||
}
|
||||
|
||||
// 根据角色ID查询菜单下拉树结构
|
||||
export function getMenuSelectTreeByRole(roleId) {
|
||||
return request({
|
||||
url: `/system/menu/roleMenuTreeSelect/${roleId}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
// 新增菜单
|
||||
export function addMenu(data) {
|
||||
return request({
|
||||
|
||||
@ -255,9 +255,6 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Role">
|
||||
// import { addRole, changeRoleStatus, changeDataScope, deleteRole, getRole,listRole,updateRole,} from '@/api/system/role';
|
||||
// import { getMenuSelectTreeByRole, getMenuSelectTree } from '@/api/system/menuApi';
|
||||
// import { getDeptSelectTree, getDeptTreeSelectByRole } from '@/api/system/deptApi';
|
||||
import * as roleApi from '@/api/system/roleApi';
|
||||
import * as menuApi from '@/api/system/menuApi';
|
||||
import * as deptApi from '@/api/system/deptApi';
|
||||
@ -441,39 +438,37 @@ function handleAdd() {
|
||||
title.value = '添加角色';
|
||||
}
|
||||
/** 修改角色 */
|
||||
function handleUpdate(row) {
|
||||
async function handleUpdate(row) {
|
||||
reset();
|
||||
const roleId = row.roleId || ids.value;
|
||||
const roleMenu = getRoleMenuTreeSelect(roleId);
|
||||
const roleMenu = await getRoleMenuTreeSelect(roleId);
|
||||
roleApi.getRole(roleId).then((response) => {
|
||||
form.value = response;
|
||||
form.value.roleSort = Number(form.value.roleSort);
|
||||
open.value = true;
|
||||
const selectedMenuList = response.selectedMenuList;
|
||||
nextTick(() => {
|
||||
roleMenu.then((res) => {
|
||||
const { checkedKeys } = res;
|
||||
checkedKeys.forEach((v) => {
|
||||
selectedMenuList.forEach((v) => {
|
||||
nextTick(() => {
|
||||
menuRef.value.setChecked(v, true, false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
title.value = '修改角色';
|
||||
});
|
||||
}
|
||||
/** 根据角色ID查询菜单树结构 */
|
||||
function getRoleMenuTreeSelect(roleId) {
|
||||
return menuApi.getMenuSelectTreeByRole(roleId).then((response) => {
|
||||
menuOptions.value = response.menus;
|
||||
return menuApi.getMenuSelectTree(roleId).then((response) => {
|
||||
menuOptions.value = response;
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据角色ID查询部门树结构 */
|
||||
function getRoleDeptTreeSelect(roleId) {
|
||||
return deptApi.getDeptSelectTreeByRole(roleId).then((response) => {
|
||||
deptOptions.value = response.depts;
|
||||
return deptApi.getDeptSelectTree(roleId).then((response) => {
|
||||
deptOptions.value = response;
|
||||
return response;
|
||||
});
|
||||
}
|
||||
@ -549,24 +544,22 @@ function dataScopeSelectChange(value) {
|
||||
}
|
||||
}
|
||||
/** 分配数据权限操作 */
|
||||
function handleDataScope(row) {
|
||||
async function handleDataScope(row) {
|
||||
reset();
|
||||
const roleDeptTreeResponse = getRoleDeptTreeSelect(row.roleId);
|
||||
const roleDeptTreeResponse = await getRoleDeptTreeSelect(row.roleId);
|
||||
|
||||
roleApi.getRole(row.roleId).then((response) => {
|
||||
form.value = response;
|
||||
openDataScope.value = true;
|
||||
nextTick(() => {
|
||||
roleDeptTreeResponse.then((res) => {
|
||||
nextTick(() => {
|
||||
if (deptRef.value) {
|
||||
deptRef.value.setCheckedKeys(res.checkedKeys);
|
||||
deptRef.value.setCheckedKeys(response.selectedDeptList);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
title.value = '分配数据权限';
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮(数据权限) */
|
||||
function submitDataScope() {
|
||||
if (form.value.roleId != undefined) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user