import { HcApi } from '../request/index'

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

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

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

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

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

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

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


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

//获取表单下的设计强度列表
export const getDesignStrengthList = (form, msg = true) => HcApi({
    url: '/api/blade-manager/mixProportion/designStrengthList',
    method: 'get',
    params: form,
}, msg)
//检查当前合同段是否开启电签
export const eVisaTaskCheck = (form, msg = true) => HcApi({
    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) => HcApi({
    url: '/api/blade-business/eVisaTaskCheck/checkFlowUserIsExistPfxFile',
    method: 'get',
    params: form,
}, msg)


//获取符合条件的预设流程（三大填报页、日志列表的批量上报、首件列表的批量上报）
export const queryFixedFlow = (form, msg = true) => HcApi({
    url: '/api/blade-business/eVisaTaskCheck/queryFixedFlow',
    method: 'post',
    data: form,
}, msg)
//资料查询获取任务流程
export const queryFixedFlow1 = (form, msg = true) => HcApi({
    url: '/api/blade-business/eVisaTaskCheck/queryFixedFlow2',
    method: 'post',
    data: form,
}, msg)
//日志填报获取任务流程
export const queryFixedFlow3 = (form, msg = true) => HcApi({
    url: '/api/blade-business/eVisaTaskCheck/queryFixedFlow3',
    method: 'post',
    data: form,
}, msg)
//检查所选的流程环节处理人是否具有审批权限（三大填报页、日志列表的批量上报、首件列表的批量上报）
export const checkCustomFlowUserIsEVisaPermissions = (form, msg = true) => HcApi({
    url: '/api/blade-business/eVisaTaskCheck/checkCustomFlowUserIsEVisaPermissions',
    method: 'post',
    data: form,
}, msg)
//检查所选的流程环节处理人是否具有审批权限（日志和首件）
export const checkCustomFlowUserIsEVisaPermissions3 = (form, msg = true) => HcApi({
    url: '/api/blade-business/eVisaTaskCheck/checkCustomFlowUserIsEVisaPermissions3',
    method: 'post',
    data: form,
}, msg)
//资料查询页面
export const checkCustomFlowUserIsEVisaPermissionsquery = (form, msg = true) => HcApi({
    url: '/api/blade-business/eVisaTaskCheck/batchCheckCustomFlowUserIsEVisaPermissions2',
    method: 'post',
    data: form,
}, msg)
//获取用户列表
export const getContractUserList = (form, msg = true) => HcApi({
    url: '/api/blade-manager/contractInfo/get-contract-userList',
    method: 'get',
    params: form,
}, msg)

//获取租户详情
export const getTenantDetail = (id) => HcApi({
    url: '/api/blade-system/tenant/detail',
    method: 'get',
    params: {
        tenantId: id,
    },
}, true)


//获取更新信息
export const getVersionJson = () => HcApi({
    url: 'version.json?time=' + new Date().getTime(),
    method: 'get',
}, false)

//获取项目下的合同段信息
export const getContractInfo = (form, msg = true) => HcApi({
    url: '/api/blade-manager/contractInfo/get-contractInfo',
    method: 'get',
    params: form,
}, msg)

//获取合同段信息
export const getErtractInfo = (form, msg = true) => HcApi({
    url: '/api/blade-manager/contractInfo/get-ertract-Info',
    method: 'get',
    params: form,
}, msg)
