import request from '@/utils/request'
import createAxios from '@/utils/request'

export function getAreaTree(data: any) {
    return request({
        url: '/user-boot/dept/getAreaTree',
        method: 'post',
        params: data
    })
}

export function getPidAreaByAreaId(data: any) {
    return request({
        url: '/user-boot/dept/getPidAreaByAreaId',
        method: 'post',
        params: data
    })
}

export function addDept(data: any) {
    return request({
        url: '/user-boot/dept/add',
        method: 'post',
        data: data
    })
}

export function updateDept(data: any) {
    return request({
        url: '/user-boot/dept/update',
        method: 'post',
        data: data
    })
}

export function deleteDept(data: any) {
    return request({
        url: '/user-boot/dept/delete',
        method: 'post',
        data: data
    })
}

export function selectPid(data: any) {
    return request({
        url: '/user-boot/dept/selectPid',
        method: 'post',
        data: data
    })
}

/**
 * 部门信息树
 */
export function deptTreeSelector() {
    return request({
        url: '/user-boot/dept/deptTreeSelector',
        method: 'GET'
    })
}

/**
 * 部门分页
 */
export function deptList(data:any) {
    return request({
        url: '/user-boot/dept/list',
        method: 'POST',
        data
    })
}


// 根据id获取所有部门信息
export function getDeptListByIds(data:any) {
    return request({
        url: '/user-boot/dept/getDeptListByIds',
        method: 'POST',
        data
    })
}

// 查询组件
export function getFatherComponent(params:any) {
    return request({
        url: '/user-boot/component/getFatherComponent',
        method: 'GET',
        params
    })
}

// 删除组件
export function deleteSubassembly(params:any) {
    return request({
        url: '/user-boot/component/delete',
        method: 'DELETE',
        params
    })
}

// 新增组件
export function componentAdd(data:any) {
    return request({
        url: '/user-boot/component/add',
        method: 'post',
        data
    })
}

// 修改组件
export function componentEdit(data:any) {
    return request({
        url: '/user-boot/component/update',
        method: 'put',
        data
    })
}

