import { stringify } from 'qs';
import {request} from '@umijs/max';
import webpath from "@/utils/webPath";

export async function queryPageForProUserData(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prouser/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function queryPageForProDeptData(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prodept/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function selectByPrimaryKeyForSystemNoticeFileForPDF(params = {}) {
   return request(`/${webpath.portalwebpath}/web/api/service/systemnoticefile/get?${stringify(params)}`);
}

export async function queryPageForFormBusinessProject(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/formbusinessproject/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function queryPageForProUserDataByWorkFlowId(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prouser/selectUserByProResourceWorkFlowId`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getCascaderAreaTreeByParentid(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/area/getCascaderAreaTreeByParentid`, {
        method: 'POST',
        data:params,
    });
}

export async function getProDeptTreeByParentidForProDept(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prodept/getProDeptTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function updateDropNodeForProDept(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prodept/updateDropNode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getProOrgTreeByParentidForProOrg(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proorg/getProOrgTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function updateDropNodeForProOrg(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proorg/updateDropNode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getAreaTreeByParentidForArea(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/area/getAreaTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function updateDropNodeForArea(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/area/updateDropNode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getProEbookArticleTypeTreeByParentidForEbookArticleSearch(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/ebookarticletype/getEbookArticleTypeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function updateDropNodeForEbookArticleSearch(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/ebookarticletype/updateDropNode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getB01UnitTreeByParentidForB01Unit(params = {}) {
    return request(`/${webpath.gabwebpath}/web/api/service/b01tunitbaseinfo/getB01UnitTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function updateDropNodeForB01Unit(params = {}) {
    return request(`/${webpath.gabwebpath}/web/api/service/b01tunitbaseinfo/updateDropNode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getAllByUserIdForFormBusinessProject(params = {}) {
    // return request(`/${webpath.portalwebpath}/web/api/service/formbusinessproject/getAllByUserIdForFormBusinessProject`, {
    return request(`/${webpath.portalwebpath}/web/api/service/formbusinessproject/getAll`, {
        method: 'POST',
        timeout: 0,
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getNoticesForSystemNoticeForWeb(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/systemnotice/getNotices`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getAllByProjNumberForFormFinanceInvoicing(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/formbusinesscontractreview/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getAllForFormBusinessContractReview(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/formbusinesscontractreview/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getAllForClientInformation(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/clientinformation/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function queryPageForConferenceInformation(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/conferenceinformation/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function showActivitiTask(params = {}) {
    return request(`/${webpath.workflowwebpath}/web/api/service/activiti/commonprocess/showActivitiTask`, {
        method: 'POST',
        data: params,
    });
}

export async function searchForHomePage(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/homepage/search`, {
        method: 'POST',
        data: params,
    });
}

export async function getDictTreeByDictIds(params = {}) {
    return request(`/${webpath.gabwebpath}/web/api/service/gsdictitem/getDictTreeByDictIds`, {
        method: 'POST',
        data: params,
    });
}

export async function updateDropNodeForProMenu(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/promenuauth/updateDropNode`, {
        method: 'POST',
        data: params
    })
}

export async function getProOrgTreeByLevelCodeForProOrg(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proorg/getProOrgTreeByLevelCode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function updateDropNodeForProResourceAction(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresourceaction/updateDropNode`, {
        method: 'POST',
        data: params
    })
}

export async function getProMenuTreeByLevelCode(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/promenu/getProMenuTreeByLevelCode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function getProMenuTreeByParentIdForProMenu(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/promenu/getProMenuTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function getProEbookArticleTypeTreeByParentid(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/ebookarticletype/getEbookArticleTypeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}
