import request from '@/utils/request'

import { business} from '@/api/index'
//responsibility
/**
 *
 * @param {*上传数据obj} data
 * @param {*分页参数} page
 */
export function responsibilityFindByPage(data, page) {
    return request({
        url: `${business}responsibility/findByPage/${page.page}/${page.size}`,
        method: 'post',
        data: data
    })
}
//根据评分表名称和年分查询数据是否存在
export function findByPfbmc(data) {
  return request({
    url: `${business}responsibility/findByPfbmc`,
   method: 'post',
    data: data
  })
}

//保存责任考核
export function save(data) {
  return request({
    url: `${business}/responsibility/save`,
    method: 'post',
      data: data
  })
}



/**
 *
 * @param {删除文件id} data
 */
export function responsibilityDeletes(data) {
    return request({
        url: `${business}responsibility/deletes`,
        method: 'delete',
        data: data
    })
}

/**
 *
 * @param {上传表单数据} data
 * @param {上传文件} formData
 */
export function responsibilityUpload(data, formData) {
    return request({
        url: `${business}examinationExcel/upload/${data.year}/${data.totalScore}/${data.pfbmc}/${data.source}`,
        method: 'post',
        data: formData
    })
}

/**
 *
 * @param {上传表单数据} data
 * @param {上传文件} formData
 */
export function importExcel(data, formData) {
  return request({
      url: `${business}examinationExcel/importKhpfbExcel/${data.year}/${encodeURI(data.pfbmc)}`,
      method: 'post',
      data: formData
  })
}


/**
 *
 * @param {根据数据id} id
 */
export function responsibilityFindByIds(id) {
    return request({
        url: `${business}responsibility/findByIds/${id}`,
        method: 'get',
    })
}






/**
 * 定制盟市考核任务
 */


/**
 *
 * @param {考核评分表} data
 */
export function responsibilityFindByRespResponsibilityInfo(data) {
    return request({
        url: `${business}responsibility/findByRespResponsibilityInfo`,
        method: 'post',
        data: data
    })
}
// 考核评分表管理---下级州市
export function responsibilityFindByFindByRespResponsibilityCity(data) {
    return request({
        url: `${business}responsibility/findByRespResponsibilityCity`,
        method: 'post',
        data: data
    })
}
// export function responsibilityFindByFindByRespResponsibilityCity() {
//   return request({
//       url: `${business}respUser/findNyqAndFnyq`,
//       method: 'get'
//   })
// }
/**
 *
 * @param {保存盟市下发评分表} data
 */

export function responsibilityFindByUpdatePfb(data) {
    return request({
        url: `${business}responsibility/updatePfb`,
        method: 'post',
        data: data
    })
}


/**
 * 张新亮
 * @param {删除下发评分表接口} id
 */

export function respScoreInputDeletes(data) {
  return request({
    url: `${business}respScoreInput/deletes`,
  method: 'delete',
    data: data
})
}


/**
 * 评分表管理---发布
 * @param {发布接口} id
 */


export function responsibilityPublish(data) {
    return request({
        // url: `${business}responsibility/publish/${id}`,
        url: `${business}responsibility/publish`,
        method: 'post',
        data: data
    })
}

/**
 * 制定盟市考核任务---发布
 * @param {发布接口} id
 */


export function respScoreInputPublish(id) {
  return request({
    url: `${business}respScoreInput/publish/${id}`,
    method: 'get',
  })
}
// 区自评查看（市局）列表
export function zpCityList(data, page) {
  return request({
    url: `${business}cityTaskDistribution/findZpCityByPage/${page.page}/${page.size}`,
    method: 'post',
    data: data
  })
}
//考核分发
export function issueToCity(data) {
  return request({
    url: `${business}cityTaskDistribution/publishKhff`,
    method: 'post',
    data: data
  })
}
//是否考核分发
export function isCheck(data) {
  return request({
    url: `${business}cityTaskDistribution/findByIsKhff`,
    method: 'post',
    data: data
  })
}
/**
 *粮食安全行政盟市长责任制-----考核评分权重-----查询可选年分
 * @param {根据数据id} id
 */
export function responsibilityFindByYear(type) {
  return request({
    url: `${business}scoringWeight/findByYear/${type}`,
  method: 'get',
})
}
//获取新考核年度
export function newExamineYear() {
  return request({
    url: `${business}scoringWeight/findByCopyYear`,
    method: 'get',
  })
}

/**
 *粮食安全行政盟市长责任制-----考核领导小组-----考核领导小组
 * @param {根据数据id} id
 */
export function getDataTree() {
  return request({
    url: `${business}respUser/getDataTree`,
    method: 'get',
  })
}

//复制评分表
export function copyPfb(data){
  return request({
    url: `${business}responsibility/saveCopyPfb`,
    method: 'post',
    data:data
  })
}

//编辑评分表

export function editPpf(data){
  return request({
    url: `${business}responsibility/updtae`,
    method: 'post',
    data:data
  })
}