import axios from "../../utils/axios";

// 获取列表
export function authAdminList(query) {
    return axios({
        url: "/admin/auth/admin/index",
        method: "get",
        params: query
    });
}

// 获取角色列表
export function authAdminRoleList(query) {
    return axios({
        url: "/admin/auth/admin/roleList",
        method: "get",
        params: query
    });
}

//根据当前角色，获取是否为客户角色
export function roleCustomers(query) {
    return axios({
        url: "/admin/auth/admin/roleCustomers",
        method: "get",
        params: query
    });
}

// 获取客户角色列表
export function authCustomerRoles(query) {
    return axios({
        url: "/admin/auth/admin/customerRoles",
        method: "get",
        params: query
    });
}

// 保存
export function authAdminSave(data, formName, method = "post") {
    let url =
        formName === "add"
            ? "/admin/auth/admin/save"
            : "/admin/auth/admin/edit";
    return axios({
        url: url,
        method: method,
        data: data
    });
}

// 删除管理员
export function authAdminDelete(data) {
    return axios({
        url: "/admin/auth/admin/delete",
        method: "post",
        data: data
    });
}

//查询可分配角色
export function getAssignableRoles(query) {
    return axios({
        url: "/auth/admin/admin/getAssignableRoles",
        method: "get",
        params: query
    });
}

//查询后台管理用户角色
export function getAdminRoles(query) {
    return axios({
        url: "/auth/admin/admin/getAdminRoles",
        method: "get",
        params: query
    });
}
