import {
	WeaTools
} from 'ecCom';

/**
 * 获取tab数据
 * @param  {Object} params [description]
 * @return {[type]}        [description]
 */
 export const getHasRight = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getHasRight`, 'GET', params)

export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTabInfo`, 'GET', params)

export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params)

export const saveFieldDefinedInfo = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}

export const removeFieldDefinedInfo = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/del`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}

export const saveGroupInfo = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}


export const saveGroupSettingInfo = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveGroup`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}

export const changeTypeInfo = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeTree`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}

export const removeGroupInfo = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTitle`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}


export const getTree = (moduleName,params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTree`, 'GET', params)

export const saveTree = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTree`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}

export const deleteTree = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTree`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}

export const changeGroup = (moduleName,params) => {
    return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeGroup`, {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(params)
    })
}

export const getEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/getEncryptFieldSettingForm`, 'GET', params)

export const saveEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/saveEncryptFieldSettingForm`, 'POST', params)

//获取字段可查看范围列表
export const getEncryptFieldScopeList = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/getEncryptFieldScopeList', 'POST', params);

//获取字段可查看范围表单
export const getEncryptFieldScopeForm = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/getEncryptFieldScopeForm', 'GET', params);

//保存字段可查看范围
export const saveEncryptFieldScopeSetting = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/saveEncryptFieldScopeSetting', 'POST', params);

//删除字段可查看范围
export const delEncryptFieldScopeSetting = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/delEncryptFieldScopeSetting', 'POST', params);

