import axios from '@/utils/axios'

export default {
  /**
   * 获取通用数据
   */
  getCommonData(params) {
    return axios.get('/xiaoshi/common/data', { params, loading: false });
  },
  /**
   * @author 沈永艺
   * @date 2022.6.21
   * @description 获取字典项之间的级联关系
   */
  getDictTreeByParentDictValue(params) {
    return axios.get('/v2/common/getDictTreeByParentDictValue', {params});
  },
  /**
   * 获取地图数据
   */
  getMapData(params) {
    return axios.get('/v2/common/static', { params })
  },
  /**
   * 获取模板标签
   */
  getTemplateLabel(params) {
    return axios.get('/v2/common/label', { params })
  },
  /**
   * 导出分析项
   */
  exportCustomItem(data, type, xAxis) {
    return axios({
      url: '/v2/common/export?type=' + type + '&xAxis=' + xAxis,
      method: 'post',
      responseType: 'blob',
      data: data
    })
  },
  /**
   * 获取行政区域
   */
  getArea(params) {
    return axios.get('/v2/common/area', { params })
  },
  /**
   * 上传分片
   */
  uploadChunks(data) {
    return axios.post('/v2/common/upload/chunks?_=' + new Date().getTime(), data)
  },
  /**
   * 合并分片
   */
  mergeChunks(params) {
    return axios({
      url: '/v2/common/upload/chunks/merge',
      method: 'post',
      params: params
    })
  }
}
