import request from '@/utils/request'

/**
 * 查询所有用户组
 * @returns 
 */
export function getGroupAll() {
    return request({
        url: '/erp/userBusinessGroup/all',
        method: 'get',
    })
}

/**
 * 分页查询用户组
 * @param {*} params 
 * @returns 
 */
export function getUserGroupList(params) {
    for (const key in params) {
        if (params[key] === null || params[key] === undefined || params[key] === '') {
            delete params[key];
        }
    }
    return request({
        url: '/erp/userBusinessGroup/list',
        method: 'post',
        data: params,
    })
}

/**
 * 获取用户组详情
 * @param {*} groupId 
 * @returns 
 */
export function getUserGroupDetail(groupId) {
    return request({
        url: '/erp/userBusinessGroup/detail/' + groupId,
        method: 'get',
    })
}

/**
 * 获取业务类型
 * @returns 
 */
export function getUserGroupBusinessTypeAll() {
    return request({
        url: '/erp/userBusinessGroup/business/all',
        method: 'get',
    })
}

/**
 * 新增用户组
 * @param {*} data 
 * @returns 
 */
export function addUserGroup(data) {
    return request({
        url: '/erp/userBusinessGroup/add',
        method: 'post',
        data,
    })
}



/**
 * 修改用户组
 * @param {*} groupId 
 * @param {*} data 
 * @returns 
 */
export function updateUserGroup(groupId, data) {
    return request({
        url: '/erp/userBusinessGroup/modify/' + groupId,
        method: 'put',
        data,
    })
}

/**
 * 删除
 * @param {*} groupId 
 * @returns 
 */
export function delUserGroup(groupId) {
    return request({
        url: '/erp/userBusinessGroup/del/' + groupId,
        method: 'DELETE'
    })
}
