import { HcApi } from '../../request/index'

export default {
    //分页
    async page(form) {
        return HcApi({
            url: '/api/blade-system/dept/list',
            method: 'get',
            params: form,
        })
    },
    //懒加载列表
    async getLazyList(form) {
        return HcApi({
            url: '/api/blade-system/dept/lazy-list',
            method: 'get',
            params: form,
        })
    },
    //详情
    async detail(id) {
        return HcApi({
            url: '/api/blade-system/dept/detail',
            method: 'get',
            params: {
                id,
            },
        })
    },
    //新增和编辑
    async submit(form) {
        return HcApi({
            url: '/api/blade-system/dept/submit',
            method: 'post',
            data: form,
        })
    },
    //删除
    async del(ids) {
        return HcApi({
            url: '/api/blade-system/dept/remove',
            method: 'post',
            params: {
                ids,
            },
        })
    },
    async getDeptTree(tenantId) {
        return HcApi({
            url: '/api/blade-system/dept/tree',
            method: 'get',
            params: {
                tenantId,
            },
        })
    },
    async getDeptLazyTree(parentId) {
        return HcApi({
            url: '/api/blade-system/dept/lazy-tree',
            method: 'get',
            params: {
                parentId,
            },
        })
    },
}
