import { baseServer, User, root, dict,inspectionApi,main,tyshxydm} from '@/api/index'
import request from '@/utils/require'

//企业信息库 列表接口
export function getList(params) {
    return request({
        url: `${inspectionApi}/companyPage/${params.pageNum}/${params.pageSize}`,
        method: 'post',
        data: params,
    })
}

//企业信息库 详情接口
export function getDetail(params) {
    return request({
        url: `${inspectionApi}/company/${params.tyshxydm}`,
        method: 'get',
    })
}

//日常检查结果---分页获取列表 查询
export function getCheckResultList(params) {
    return request({
        url: `${inspectionApi}/dailyCheckResultPage?pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
        method: 'post',
        data: params
    })
}

export function warehouseList(params) {
    return request({
        url: `${inspectionApi}/warehouseList`,
        method: 'post',
        data: params,
    })
}

// 仓房字典
export function warehouseDictionary(params) {
    return request({
        url: `${dictionaryApi}/company`,
        method: 'put',
        data: params,
    })
}

export function tree(data) {
    return request({
        url: `${User}/org/tree`,
        method: 'post',
        data: data
    })
}

//新增企业-提交
export function xzqyFun(data) {
    return request({
        url: `${inspectionApi}/findCompany`,
        method: 'post',
        data: data
    })
}


//新增企业-申请变更
export function insertEntitySelective(data) {
    return request({
        url: `${inspectionApi}/base/qybgsq/insertEntitySelective`,
        method: 'post',
        data: data
    })
}

//企业- 查询-申请变更
export function selectByEntity(data) {
    return request({
        url: `${inspectionApi}/base/qybgsq/selectByEntity`,
        method: 'post',
        data: data
    })
}

//企业- 审批-申请变更
export function updateByEntitySelective(data) {
    return request({
        url: `${inspectionApi}/base/qybgsq/updateByEntitySelective`,
        method: 'post',
        data: data
    })
}
//
// //企业- 仓房信息
// export function qywarehouseList(data) {
//     return request({
//         url: `${inspectionApi}/base/qybgsq/updateByEntitySelective`,
//         method: 'post',
//         data: data
//     })
// }
//企业- 仓房信息
export function qywarehouseList(data) {
    return request({
        url: `${inspectionApi}/storagequalificationapply/selectStorageQualificationApplyDetail`,
        method: 'post',
        data
    })
}

//企业- 查询-收购资格变更
export function sgzgSelectByEntity(data) {
    return request({
        url: `${inspectionApi}/base/shouGouZiGe/selectByEntity`,
        method: 'post',
        data: data
    })
}
//导出企业信息库
export function exportFun(data) {
    return request({
        url: `${baseServer}/company/exportByEntity`,
        method: 'post',
        data: data,
        responseType:"blob",
        headers:{
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' // 设置完以后 传入的params对象就会时候用formdata传参的方式
        }
    })
}

//
export function queryEnterpriseInformation(params) {
    return request({
        url: `${tyshxydm}/dataQuery/queryEnterpriseInformation?entname=${params.entname}&orgno=${params.orgno}`,
        method: 'get',
    })
}