mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-10 09:05:07 +08:00
完成 Role 模块的迁移
This commit is contained in:
@ -25,24 +25,6 @@ export function getDept(deptId) {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询部门下拉树结构
|
||||
// TODO 准备删除
|
||||
export function treeselect() {
|
||||
return request({
|
||||
url: '/system/dept/treeselect',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据角色ID查询部门树结构
|
||||
// TODO 准备删除
|
||||
export function roleDeptTreeselect(roleId) {
|
||||
return request({
|
||||
url: '/system/dept/roleDeptTreeselect/' + roleId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取部门精简信息列表
|
||||
export function listSimpleDepts() {
|
||||
return request({
|
||||
@ -76,3 +58,6 @@ export function delDept(deptId) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export class treeselect {
|
||||
}
|
||||
|
@ -16,3 +16,12 @@ export function assignRoleMenu(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 赋予角色数据权限
|
||||
export function assignRoleDataScope(data) {
|
||||
return request({
|
||||
url: '/system/permission/assign-role-data-scope',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -35,15 +35,6 @@ export function updateRole(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 角色数据权限
|
||||
export function dataScope(data) {
|
||||
return request({
|
||||
url: '/system/role/dataScope',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 角色状态修改
|
||||
export function changeRoleStatus(id, status) {
|
||||
const data = {
|
||||
|
@ -30,7 +30,7 @@ export const SysRoleTypeEnum = {
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限的泛微枚举
|
||||
* 数据权限的范围枚举
|
||||
*/
|
||||
export const SysDataScopeEnum = {
|
||||
ALL: 1, // 全部数据权限
|
||||
|
@ -55,15 +55,15 @@ export function resetForm(refName) {
|
||||
|
||||
// 添加日期范围
|
||||
export function addDateRange(params, dateRange, propName) {
|
||||
var search = params;
|
||||
search.params = {};
|
||||
if (null != dateRange && '' != dateRange) {
|
||||
const search = params;
|
||||
search.params = {};
|
||||
if (null != dateRange && '' !== dateRange) {
|
||||
if (typeof(propName) === "undefined") {
|
||||
search.params["beginTime"] = dateRange[0];
|
||||
search.params["endTime"] = dateRange[1];
|
||||
search["beginTime"] = dateRange[0];
|
||||
search["endTime"] = dateRange[1];
|
||||
} else {
|
||||
search.params["begin" + propName] = dateRange[0];
|
||||
search.params["end" + propName] = dateRange[1];
|
||||
search["begin" + propName] = dateRange[0];
|
||||
search["end" + propName] = dateRange[1];
|
||||
}
|
||||
}
|
||||
return search;
|
||||
|
@ -248,8 +248,8 @@ import {
|
||||
updateRole
|
||||
} from "@/api/system/role";
|
||||
import {listSimpleMenus} from "@/api/system/menu";
|
||||
import {assignRoleMenu, listRoleMenus} from "@/api/system/permission";
|
||||
import {listSimpleDepts, treeselect as deptTreeselect} from "@/api/system/dept";
|
||||
import {assignRoleMenu, listRoleMenus, assignRoleDataScope} from "@/api/system/permission";
|
||||
import {listSimpleDepts} from "@/api/system/dept";
|
||||
import {SysCommonStatusEnum, SysDataScopeEnum} from "@/utils/constants";
|
||||
import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict";
|
||||
|
||||
@ -326,7 +326,10 @@ export default {
|
||||
/** 查询角色列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
|
||||
listRole(this.addDateRange(this.queryParams, [
|
||||
this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined,
|
||||
this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined,
|
||||
])).then(
|
||||
response => {
|
||||
this.roleList = response.data.list;
|
||||
this.total = response.data.total;
|
||||
@ -387,6 +390,7 @@ export default {
|
||||
sort: 0,
|
||||
deptIds: [],
|
||||
menuIds: [],
|
||||
dataScope: undefined,
|
||||
deptCheckStrictly: false,
|
||||
remark: undefined
|
||||
};
|
||||
@ -485,11 +489,11 @@ export default {
|
||||
// 处理 menuOptions 参数
|
||||
this.deptOptions = [];
|
||||
this.deptOptions.push(...this.handleTree(response.data, "id"));
|
||||
});
|
||||
// 获得角色拥有的数据权限
|
||||
getRole(row.id).then(response => {
|
||||
// TODO 搞一搞
|
||||
// this.$refs.dept.setCheckedKeys(res.checkedKeys);
|
||||
// 获得角色拥有的数据权限
|
||||
getRole(row.id).then(response => {
|
||||
this.form.dataScope = response.data.dataScope;
|
||||
this.$refs.dept.setCheckedKeys(response.data.dataScopeDeptIds, false);
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@ -515,11 +519,10 @@ export default {
|
||||
/** 提交按钮(数据权限) */
|
||||
submitDataScope: function() {
|
||||
if (this.form.id !== undefined) {
|
||||
// this.form.deptIds = this.getDeptAllCheckedKeys();
|
||||
debugger
|
||||
dataScope({
|
||||
assignRoleDataScope({
|
||||
roleId: this.form.id,
|
||||
deptIds: this.form.dataScope !== SysDataScopeEnum.DEPT_CUSTOM ? [] :
|
||||
dataScope: this.form.dataScope,
|
||||
dataScopeDeptIds: this.form.dataScope !== SysDataScopeEnum.DEPT_CUSTOM ? [] :
|
||||
this.$refs.dept.getCheckedKeys(false)
|
||||
}).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
|
Reference in New Issue
Block a user