import request from '@/utils/request'

// 查询地址树
export function createTopGrid(data) {
  return request({
    url: '/grid/region/top/create',
    method: 'post',
    data: data
  })
}
export function createSecGrid(data) {
  return request({
    url: '/grid/region/sec/create',
    method: 'post',
    data: data
  })
}

// 创建虚拟网格客户导入方式/管户导入方式
export function createVirGrid(data) {
  return request({
    url: '/grid/virtual/create',
    method: 'post',
    data
  })
}

export function uploadFile(data) {
  return request({
    url: '/grid/virtual/import',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}
export function uploadFileUpdate(data) {
  return request({
    url: '/grid/virtual/import/update',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}

export function uploadFileGuan(data) {
  return request({
    url: '/grid/virtual/import/relate',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}

export function uploadFileGuanUpdate(data) {
  return request({
    url: '/grid/virtual/import/relate/update',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}

// 查询一级网格列表
export function getTopList(query) {
  return request({
    url: '/grid/region/top/list',
    method: 'get',
    params: query
  })
}
// 二级网格客户经理
export function getUserListByGridId(query) {
  return request({
    url: '/grid/region/user/list',
    method: 'get',
    params: query
  })
}

// 二级网格客户经理
export function getUserListByDeptIds(query) {
  return request({
    url: '/grid/virtual/user/list',
    method: 'get',
    params: query
  })
}

//网格查询
export function getRegionTable(query) {
  return request({
    url: '/system/gridSelect/list/grid',
    method: 'get',
    params: query
  })
}

// 查询预计客户数
export function getCustCount(query) {
  return request({
    url: '/grid/region/cust/count',
    method: 'post',
    data: query
  })
}

// 查询选择客户列表
export function getGroupList(query) {
  return request({
    url: '/system/group/getGroupList',
    method: 'get',
    params: query
  })
}

// 导入客群
export function listByGroupId(query) {
  return request({
    url: '/system/customer/listByGroupId',
    method: 'get',
    params: query
  })
}