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