/*
 * @Author: zc
 * @Description: 角色管理
 * @version:
 * @Date: 2022-08-09 16:19:55
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-11 15:34:26
 */
import request from '/@/utils/request';
/**
 * @description: 获取角色列表
 * @param {object} params
 * @return {*}
 */
export const getRoleListPaged = (params: object) => {
	return request({
		url: '/api/v1/Role/paged',
		method: 'get',
		params: params,
	});
};
/**
 * @description: 新增角色
 * @param {object} params
 * @return {*}
 */
export const addRole = (params: object) => {
	return request({
		url: '/api/v1/Role',
		method: 'post',
		data: params,
	});
};
/**
 * @description: 更新角色
 * @param {object} params
 * @return {*}
 */
export const updateRole = (params: object) => {
	return request({
		url: '/api/v1/Role',
		method: 'put',
		data: params,
	});
};
/**
 * @description: 删除角色
 * @param {string} roleId 角色ID
 * @return {*}
 */
export const delRole = (roleId: string) => {
	return request({
		url: `/api/v1/Role/${roleId}`,
		method: 'delete',
	});
};
/**
 * @description: 获取角色权限
 * @param {string} object 角色ID
 * @return {*}
 */
 export const getRolePower = (params?:object) => {
	return request({
		url: `/api/v1/Role/getauthority`,
		method: 'get',
		params
	});
};
/**
 * @description: 分配角色
 * @param {object} data 
 * @return {*}
 */
 export const setRolePower = (data: object) => {
	return request({
		url: `/api/v1/Role/allocationauthority`,
		method: 'post',
		data
	});
};
/**
 * @description: 根据id批量查询用户
 * @param {object} params  ids
 * @return {*}
 */
export const getUserListByIds = (params: any) => {
	return request({
		url: `/api/v1/User${params}`,
		method: 'get',
	});
};
/**
 * @description: 获取数据表
 * @param {object} 
 * @return {*}
 */
 export const dataAuthList = () => {
	return request({
		url: `/api/v1/Role/datatable-list`,
		method: 'get',
	});
};
/**
 * @description: 新增数据权限
 * @param {object} data  
 * @return {*}
 */
 export const addDataAuth = (data: object) => {
	return request({
		url: `/api/v1/Role/add-data-authority`,
		method: 'post',
		data
	});
};
/**
 * @description: 修改数据权限
 * @param {object} data  
 * @return {*}
 */
 export const editDataAuth = (data: object) => {
	return request({
		url: `/api/v1/Role/update-data-authority`,
		method: 'post',
		data
	});
};
/**
 * @description: 删除数据权限
 * @param {string} id  
 * @return {*}
 */
 export const deleteDataAuth = (id: string) => {
	return request({
		url: `/api/v1/Role/remove-data-authority/${id}`,
		method: 'delete',
	});
};
/**
 * @description: 获取角色所有数据权限设置
 * @param {object} params  
 * @return {*}
 */
 export const getdataauthoritybyrole = (params: object) => {
	return request({
		url: `/api/v1/Role/getdataauthoritybyrole`,
		method: 'get',
		params
	});
};
