import request from '@/router/axios';

export const submitContractInfo = (contractInfo) => {
    return request({
        url: '/api/blade-manager/contractInfo/submit',
        method: 'post',
        data: contractInfo
    })
}
export const findContractByProjectId = (pid) => {
    return request({
        url: '/api/blade-manager/contractInfo/getContractInfoByPid',
        method: 'get',
        params: {
            pid
        }
    })
}

export const getContractInfo2 = (params) => {
    return request({
        url: '/api/blade-manager/contractInfo/detail2',
        method: 'get',
        params
    })
}

export const getContractInfo = (id) => {
    return request({
        url: '/api/blade-manager/contractInfo/detail',
        method: 'get',
        params: {
            id
        }
    })
}
export const delFileFromUrl = (url) => {
    return request({
        url: '/api/blade-manager/contractInfo/deleteFile',
        method: 'get',
        params: {
            url
        }
    })
}

export const saveUserInfoByProject = (list) => {
    return request({
        url: '/api/blade-manager/contractInfo/saveUserInfoByProject',
        method: 'post',
        data: list
    })
}

export const findAllUserByCondition = (info, size, current) => {
    return request({
        url: `/api/blade-manager/contractInfo/getAllUserByCondition?size=${size}&current=${current}`,
        method: 'get',
        params: {
            ...info,
        }
    })
}
export const findUserListByCondition = (info) => {
    return request({
        url: '/api/blade-manager/contractInfo/getUserListByCondition',
        method: 'get',
        params: info
    })
}

export const findUserList = () => {
    return request({
        url: '/api/blade-manager/contractInfo/getUserList',
        method: 'get',
        params: {

        }
    })
}

export const removeUsersByIds = (ids) => {
    return request({
        url: '/api/blade-manager/contractInfo/removeUsersByIds',
        method: 'post',
        params: {
            ids
        }
    })
}

export const removeContractInfo = (ids) => {
    return request({
        url: '/api/blade-manager/contractInfo/remove',
        method: 'post',
        params: {
            ids
        }
    })
}

export const findJobByRoleId = (id) => {
    return request({
        url: '/api/blade-manager/contractInfo/getJobByRoleId',
        method: 'get',
        params: {
            id
        }
    })
}

export const resetPasswordByUserId = (userId) => {
    return request({
        url: '/api/blade-manager/contractInfo/resetPasswordByUserId',
        method: 'post',
        params: {
            userId
        }
    })
}

export const submitWbsTreeInContract = (obj) => {
    return request({
        url: '/api/blade-manager/contractInfo/submitWbsTreeInContract',
        method: 'post',
        data: obj
    })
}

export const getContractInfoTree = (wbsId, projectId, contractId) => {
    return request({
        url: '/api/blade-manager/contractInfo/tree',
        method: 'get',
        params: {
            wbsId,
            projectId,
            contractId,
        }
    })
}

//新 通过角色方获取岗位
export const findPostByType = (id) => {
        return request({
            url: '/api/blade-system/post/findPostByType',
            method: 'get',
            params: {
                category: id
            }
        })
    }
    //
export const saveUserInfoByProjectTow = (list) => {
    return request({
        url: '/api/blade-manager/contractInfo/saveUserInfoByProjectTow',
        method: 'post',
        data: list
    })
}
export const searchRole = (list) => {
    return request({
        url: '/api/blade-system/search/role',
        method: 'get',
        data: list
    })
}
