import request from '@/utils/request'
import {getPatentTypes,getApplicantTypes,getAllPatentTypeIdStr,getAllApplicantTypeIdStr,getPatentType,getApplicantType} from "@/api/staticdata";



export function getHeaderList2(patentTypes,applicantTypes) {
  if(!patentTypes){
    patentTypes= getAllPatentTypeIdStr();
  }
  if(!applicantTypes){
    applicantTypes=getAllApplicantTypeIdStr();
  }

  let res=[];

  let patentTypeArr=patentTypes.split(',');
  let applicantTypeArr=applicantTypes.split(',');

  for(let i=0;i<patentTypeArr.length;i++){
    let item={};
    item.patentType=getPatentType(patentTypeArr[i]);

    item.applicantTypes=[];

    item.applicantTypes.push('数量');
    item.applicantTypes.push('占比');
    for(let j=0;j<applicantTypeArr.length;j++){
      item.applicantTypes.push(getApplicantType(applicantTypeArr[j]));
    }
    res.push(item);

  }


  return res;
}

// 获取动态表头
export function getHeaderList(patentTypes,applicantTypes) {

  let params={};
  params.patentTypes=patentTypes;
  params.applicantTypes=applicantTypes;
  console.log('patentTypes:'+patentTypes+',applicantTypes:'+applicantTypes)
  return request({
    url: '/report/rzlApplicantRankingInfo/getHeader',
    method: 'get',
    params: params
  })
}
// 获取查询年列表
export function getYearList() {
  return request({
    url: '/system/urPatentValid/getYearList',
    method: 'get'
  })
}
// 获取省市列表
export function getRegionList(data) {
  return request({
    url: '/system/bladeRegion/getDataList',
    method: 'post',
    data: data
  })
}



// 查询专利授权-主IPC统计列表
export function listRzsIpcStatisticsInfo(query) {
  return request({
    url: '/reportrzs/rzsIpcStatisticsInfo/list',
    method: 'get',
    params: query
  })
}

// 查询专利授权-主IPC统计详细
export function getRzsIpcStatisticsInfo(id) {
  return request({
    url: '/reportrzs/rzsIpcStatisticsInfo/' + id,
    method: 'get'
  })
}

// 新增专利授权-主IPC统计
export function addRzsIpcStatisticsInfo(data) {
  return request({
    url: '/reportrzs/rzsIpcStatisticsInfo',
    method: 'post',
    data: data
  })
}

// 修改专利授权-主IPC统计
export function updateRzsIpcStatisticsInfo(data) {
  return request({
    url: '/reportrzs/rzsIpcStatisticsInfo',
    method: 'put',
    data: data
  })
}

// 删除专利授权-主IPC统计
export function delRzsIpcStatisticsInfo(id) {
  return request({
    url: '/reportrzs/rzsIpcStatisticsInfo/' + id,
    method: 'delete'
  })
}
