import request from '@/utils/request'

// 修改上传图片方法，添加正确的请求配置
export function uploadImage(data) {
  console.log('data', data)
  return request({
    url: '/oss/api/oss/upload',
    data: data,
    method: 'post',
    // 添加以下配置
    headers: {
      'Content-Type': 'multipart/form-data' // 明确指定为multipart类型
    },
    // 如果使用axios，需要设置这个参数
    transformRequest: [
      function (data) {
        return data
      }
    ]
  })
}
// 获取系统左侧菜单
export function getMenuLists(projectBizId, tenantBizId) {
  return request({
    url: `/user/api/sysUser/login/permission/project/getMenuRouters?projectBizId=${projectBizId}&tenantBizId=${tenantBizId}`,
    method: 'get'
  })
}
// 用token获取用户详细信息
export function getUserInfo(token) {
  return request({
    url: `/user/api/sysUser/getUserInfoByToken?token=${token}`,
    method: 'get'
  })
}
// 获取国家地区信息
export function getCountryInfo() {
  return request({
    url: `/user/api/mdCountry/group`,
    method: 'get'
  })
}
// 搜索国家地区信息
export function getSearchCountry(name) {
  return request({
    url: `/user/api/mdCountry/search?name=${name}`,
    method: 'get'
  })
}
// 查询租户用户关系列表
export function listTenantUser(data) {
  return request({
    url: '/user/api/relTenantUser/page',
    method: 'post',
    data: data
  })
}
// 查询多个字典列表
export function getMoreDicts(data) {
  return request({
    url: '/user/api/sysDict/type/list',
    method: 'post',
    data: data
  })
}
// 查询保险产品列表
export function getInsuranceProductList(data) {
  return request({
    url: '/insurance/base/api/insuranceProduct/page',
    method: 'post',
    data: data
  })
}
// 查询保险附加产品列表
export function getAdditionalProductList(data) {
  return request({
    url: '/insurance/base/api/insuranceAdditionalProduct/page',
    method: 'post',
    data: data
  })
}
//获取保险公司列表
export function getAllCompanys(data) {
  return request({
    url: '/user/api/sysDept/company/page',
    method: 'post',
    data: data
  })
}
//获取转介人列表
export function getClientUser(data) {
  return request({
    url: '/user/api/clientUser/page',
    method: 'post',
    data: data
  })
}
// 银行列表
export function getBankList(data) {
  return request({
    url: '/base/api/bank/page',
    method: 'post',
    data: data
  })
}
// 转介人列表
export function getUserSaleExpandList(data) {
  return request({
    url: '/insurance/base/api/userSaleExpand/page',
    method: 'post',
    data: data
  })
}
// 第二个附加险列表
export function secondAdditonalList(data) {
  return request({
    url: '/product/api/relProjectProductLaunch/parameter/page',
    method: 'post',
    data: data
  })
}
// 获取签单员列表
export function getAllSignList(data) {
  return request({
    url: '/insurance/base/api/userSignExpand/page',
    method: 'post',
    data: data
  })
}
// 获取团队列表
export function getAllTeam(data) {
  return request({
    url: '/csf/api/team/page',
    method: 'post',
    data: data
  })
}
// 获取保险公司列表
export function getInsuranceCompany(data) {
  return request({
    url: '/insurance/base/api/insuranceCompany/page',
    data: data,
    method: 'post'
  })
}
// 获取保险险种列表
export function getInsuranceCategory(data) {
  return request({
    url: '/insurance/base/api/insuranceCategory/page',
    data: data,
    method: 'post'
  })
}
// 通用excel导入
export function importExcel(data) {
  return request({
    url: '/oss/api/excel/import',
    method: 'post',
    data: data
  })
}
// 上传获取材料列表
export function uploadMaterialList(data) {
  return request({
    url: '/oss/api/material/list',
    data: data,
    method: 'post'
  })
}
// 删除上传文件
export function delUploadFile(fileBizId) {
  return request({
    url: `/oss/api/ossFile/del?fileBizId=${fileBizId}`,
    method: 'delete'
  })
}
// 上传获取材料列表2
export function uploadRelObjectMaterialList(data) {
  return request({
    url: '/oss/api/relObjectMaterial/page',
    data: data,
    method: 'post'
  })
}
// 删除材料
export function delMaterial(relObjectMaterialBizId) {
  return request({
    url: `/oss/api/relObjectMaterial/del?relObjectMaterialBizId=${relObjectMaterialBizId}`,
    method: 'delete'
  })
}
// 获取文件详情
export function uploadOssFileList(data) {
  return request({
    url: '/oss/api/ossFile/list',
    data: data,
    method: 'post'
  })
}
// 提交附件
export function uploadOssFileSubmit(data) {
  return request({
    url: '/oss/api/relObjectMaterial/upload/submit',
    data: data,
    method: 'post'
  })
}
// 下载材料包
export function downloadCompressedFile(data) {
  return request({
    url: '/oss/api/material/download/compressed/file',
    data: data,
    method: 'post'
  })
}
// 获取保险对账公司列表
export function insuranceReconciliationCompany(data) {
  return request({
    url: '/insurance/base/api/insuranceReconciliationCompany/page',
    data: data,
    method: 'post'
  })
}
// 获取STS凭证
export function getStstoken(projectBizId) {
  return request({
    url: `/oss/api/sts/sts-token?projectBizId=${projectBizId}`,
    method: 'get'
  })
}

// 大文件分片上传接口
export function batchSaveFiles(data) {
  return request({
    url: '/oss/api/sts/batch/save/files',
    data: data,
    method: 'post'
  })
}
