import {httpApi} from "../request/httpApi";

export const ApprovalApi = (url,form, msg = true) => httpApi({
    url: '/api/blade-business/' + url,
    method: 'post',
    data: form
}, msg);

export const batchApproval = (form, msg = true) => httpApi({
    url: '/api/blade-business/archiveFile/batchApproval',
    method: 'post',
    data: form
}, msg);

//短信验证
export const sendNotice = (form, msg = true) => httpApi({
    url: '/api/blade-business/task/send-notice',
    method: 'post',
    params: form
}, msg);

//短信过期时间
export const saveSmsTimeout = (form, msg = true) => httpApi({
    url: '/api/blade-business/task/save-sms-timeout',
    method: 'get',
    params: form
}, msg);

//用户配置保存
export const userConfigSave = (form, msg = true) => httpApi({
    url: '/api/blade-business/defaultConfig/saveOrUpdate',
    method: 'post',
    data: form
}, msg);

//用户配置详情
export const userConfigInfo = (form, msg = true) => httpApi({
    url: '/api/blade-business/defaultConfig/detail',
    method: 'get',
    params: form
}, msg);

//获取上报批次
// export const getReportNumber = (form, msg = true) => httpApi({
//     url: '/api/blade-business/informationWriteQuery/getReportNumberByContractId',
//     method: 'get',
//     params: form
// }, msg);
export const getReportNumber = (form, msg = true) => httpApi({
    url: 'api/blade-business/task/query-batch-list-two',
    method: 'get',
    params: form
}, msg);
//获取类型
export const getDictionary = (form, msg = true) => httpApi({
    url: '/api/blade-system/dict/dictionary',
    method: 'get',
    params: form
}, msg);


//获取表单的下拉框测站点数据
export const getDapSiteData = (form, msg = true) => httpApi({
    url: '/api/blade-business/dap/site',
    method: 'get',
    params: form
}, msg);


//检查当前合同段是否开启电签
export const eVisaTaskCheck = (form, msg = true) => httpApi({
    url: '/api/blade-business/eVisaTaskCheck/checkContractIsOpenEVisa',
    method: 'get',
    params: form
}, msg);

export const eVisaTaskCheckApi = async (form) => {
    const {error, code, msg, data} = await eVisaTaskCheck(form)
    //判断数据
    if (!error && code === 200 && data === true) {
        return true
    } else {
        window.$message?.warning(msg)
        return false
    }
}


//检查当前审批人是否存在证书
export const checkFlowUserIsExistPfxFile = (form, msg = true) => httpApi({
    url: '/api/blade-business/eVisaTaskCheck/checkFlowUserIsExistPfxFile',
    method: 'get',
    params: form
}, msg);


//获取符合条件的预设流程（三大填报页、日志列表的批量上报、首件列表的批量上报）
export const queryFixedFlow = (form, msg = true) => httpApi({
    url: '/api/blade-business/eVisaTaskCheck/queryFixedFlow',
    method: 'post',
    data: form
}, msg);

//检查所选的流程环节处理人是否具有审批权限（三大填报页、日志列表的批量上报、首件列表的批量上报）
export const checkCustomFlowUserIsEVisaPermissions = (form, msg = true) => httpApi({
    url: '/api/blade-business/eVisaTaskCheck/checkCustomFlowUserIsEVisaPermissions',
    method: 'post',
    data: form
}, msg);


//获取用户列表
export const getContractUserList = (form, msg = true) => httpApi({
    url: '/api/blade-manager/contractInfo/get-contract-userList',
    method: 'get',
    params: form
}, msg);
