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

export default {
    //分页
    async page(form) {
        return HcApi({
            url: '/api/blade-system/role/list',
            method: 'get',
            params: {
                form,
                current: 1,
                size: 200,
            },
        }, false)
    },
    //新增和编辑
    async submit(form) {
        return HcApi({
            url: '/api/blade-system/role/submit',
            method: 'post',
            data: form,
        }, false)
    },
    //删除
    async del(ids) {
        return HcApi({
            url: '/api/blade-system/role/remove',
            method: 'post',
            params: {
                ids,
            },
        }, false)
    },
    async grant(form) {
        return HcApi({
            url: '/api/blade-system/role/grant',
            method: 'post',
            data: form,
        }, false)
    },
    async grantTree() {
        return HcApi({
            url: '/api/blade-system/menu/grant-tree',
            method: 'get',
        }, false)
    },
    async getRole(roleIds) {
        return HcApi({
            url: '/api/blade-system/menu/role-tree-keys',
            method: 'get',
            params: {
                roleIds,
            },
        }, false)
    },
    async roleTree() {
        return HcApi({
            url: '/api/blade-system/role/tree',
            method: 'get',
            params: {
                tenantId: '',
            },
        }, false)
    },
    async getRoleTreeById(roleId) {
        return HcApi({
            url: '/api/blade-system/role/tree-by-id',
            method: 'get',
            params: {
                roleId,
            },
        }, false)
    },
    async treeUser(roleId) {
        return HcApi({
            url: '/api/blade-system/role/treeTow',
            method: 'get',
            params: {
                roleId,
            },
        }, false)
    },
    // 编辑加载项目合同段信息
    async findProjectAndContractList(form) {
        return HcApi({
            url: '/api/blade-manager/projectInfo/get-project-contract-list',
            method: 'get',
            params: form ?? {},
        }, false)
    },
    // 编辑新增项目合同段信息
    async saveUserInfoByProjectTow(form) {
        return HcApi({
            url: '/api/blade-manager/contractInfo/save-userInfo-by-project-tow',
            method: 'post',
            data: form ?? {},
        }, false)
    },
}
