import Request from '@/utils/request'
import {
    business,
    file,
    dict,
    User,
    files,
    rootLiwai
} from '@/api/index'
/* -------填报时间设置-------*/
export function findYear(year,id) {
    return Request({
      url: `${business}responsibility/findById/${year}/${id}`,
      method: 'get',
    })
}

/* -------填报时间修改-------*/
export function updateYearTime(data) {
    return Request({
        url: `${business}responsibility/update`,
        method: 'post',
        data: data
    })
}

/* -------填报时间保存-------*/
export function saveYearTime(data) {
    return Request({
        url: `${business}responsibility/save`,
        method: 'post',
        data: data
    })
}





/* -------根据年份year查询考核内容可填分数-------*/
export function examinationContentSorce(year) {
  return Request({
    url: `${business}examinationContent/findBySorce/${year}`,
    method: 'get',
})
}



/* -------考核内容列表-------*/
export function examinationContentList(data, page, size) {
    return Request({
        url: `${business}examinationContent/findByPage/${page}/${size}`,
        method: 'post',
        data: data
    })
}
/* -------考核内容保存-------*/
export function examinationContentSave(data) {
    return Request({
        url: `${business}examinationContent/save`,
        method: 'post',
        data: data
    })
}
/* -------考核内容修改-------*/
export function examinationContentUpdate(data) {
    return Request({
        url: `${business}examinationContent/update`,
        method: 'post',
        data: data
    })
}

/* -------考核内容删除-------*/
export function examinationContentDelete(data) {
    return Request({
        url: `${business}examinationContent/deletes`,
        method: 'delete',
        data: data
    })
}
/*-----------------根据id查询考核内容是否发布-------------------*/
export function examinationContentfindIfRelease(id) {
  return Request({
    url: `${business}/examinationContent/findIfRelease/${id}`,
  method: 'get'
})
}







/* -------考核事项新增的考核内容列表-------*/
export function examinationContentOption(year,responsibilityId) {
    return Request({
        url: `${business}examinationContent/findByYearAndOrgId/${year}/${responsibilityId}`,
        method: 'get',
    })
}

/* -------考核事项列表-------*/
export function assessmentMattersList(data, page, size) {
    return Request({
        url: `${business}examinationItem/findByPage/${page}/${size}`,
        method: 'post',
        data: data
    })
}

/* -------根据考核内容ID和和填报设置ID查询重点考核事项填分数-------*/
export function assessmentMattersSorce(contentId,responsibilityId) {
    return Request({
      url: `${business}examinationItem/findBySorce/${contentId}/${responsibilityId}`,
      method: 'get',
    })
}


/* -------考核事项保存-------*/
export function assessmentMattersSave(data) {
    return Request({
        url: `${business}examinationItem/save`,
        method: 'post',
        data: data
    })
}
/* -------考核事项修改-------*/
export function assessmentMattersUpdate(data) {
    return Request({
        url: `${business}examinationItem/update`,
        method: 'post',
        data: data
    })
}
/* -------考核事项删除-------*/
export function assessmentMattersDelete(data) {
    return Request({
        url: `${business}examinationItem/deletes`,
        method: 'delete',
        data: data
    })
}

/*-----------------根据id查询考核事项是否发布-------------------*/
export function assessmentMattersfindIfRelease(id) {
  return Request({
    url: `${business}/examinationItem/findIfRelease/${id}`,
  method: 'get'
})
}




/* -------考核指标新增的考核内容列表-------*/
export function assessmentMattersOption(year,responsibilityId) {
    return Request({
        url: `${business}examinationItem/findByYearAndOrgId/${year}/${responsibilityId}`,
        method: 'get',
    })
}

/* -------考核指标列表-------*/
export function assessmentIndexList(data, page, size) {
    return Request({
        url: `${business}examinationQuota/findByPage/${page}/${size}`,
        method: 'post',
        data: data
    })
}


/* -------根据重点考核事项 id 查询 考核指标 可填分数-------*/
export function assessmentIndexSorce(itemId,responsibilityId) {
  return Request({
    url: `${business}examinationQuota/findBySorce/${itemId}/${responsibilityId}`,
  method: 'get',
})
}


/* -------考核指标保存-------*/
export function assessmentIndexSave(data) {
    return Request({
        url: `${business}examinationQuota/save`,
        method: 'post',
        data: data
    })
}
/* -------考核指标修改-------*/
export function assessmentIndexUpdate(data) {
    return Request({
        url: `${business}examinationQuota/update`,
        method: 'post',
        data: data
    })
}
/* -------考核指标删除-------*/
export function assessmentIndexDelete(data) {
    return Request({
        url: `${business}examinationQuota/deletes`,
        method: 'delete',
        data: data
    })
}

/*-----------------根据id查询考核指标是否发布-------------------*/
export function assessmentIndexfindIfRelease(id) {
  return Request({
    url: `${business}/examinationQuota/findIfRelease/${id}`,
  method: 'get'
})
}



/* -------考核目标新增的考核内容列表-------*/
export function assessmentIndexOption(year,responsibilityId) {
    return Request({
        url: `${business}examinationQuota/findByYearAndOrgId/${year}/${responsibilityId}`,
        method: 'get',
    })
}

/* -------考核目标列表-------*/
export function assessmentTargetList(data, page, size) {
    return Request({
        url: `${business}examinationTask/findByPage/${page}/${size}`,
        method: 'post',
        data: data
    })
}
/* -------考核目标保存-------*/
export function assessmentTargetSave(data) {
    return Request({
        url: `${business}examinationTask/save`,
        method: 'post',
        data: data
    })
}



/* -------根据 考核指标 id 查询 考核目标任务 可填分数-------*/
export function assessmentTargetScore(quotaId,responsibilityId) {
  return Request({
    url: `${business}examinationTask/findBySorce/${quotaId}/${responsibilityId}`,
    method: 'get',
  })
}

/* -------考核目标修改-------*/
export function assessmentTargetUpdate(data) {
    return Request({
        url: `${business}examinationTask/update`,
        method: 'post',
        data: data
    })
}
/* -------考核目标删除-------*/
export function assessmentTargetDelete(data) {
    return Request({
        url: `${business}examinationTask/deletes`,
        method: 'delete',
        data: data
    })
}
/* -------考核目标详情-------*/
export function assessmentTargetDetail(id) {
    return Request({
        url: `${business}examinationTask/findById/${id}`,
        method: 'get',
    })
}

/* -------考核目标部门-------*/
export function assessmentTargetDeptName(code) {
    return Request({
        url: `${business}respUser/findByDeptName/${code}`,
        method: 'post',
    })
}
/* -------考核目标发布-------*/
export function assessmentTargetrRelease(data) {
    return Request({
        url: `${business}examinationTask/updateTaskStatus?responsibilityId=${data.responsibilityId}&status=${data.status}`,
        method: 'get',
    })
}

/* 根据填报设置ID查询 查询 编辑完成按钮和重新编按钮 显示 那一个*/
export function getIfShowButtonTask(data) {
  return Request({
    url: `${business}examinationTask/getIfShowButtonTask/${data.responsibilityId}`,
    method: 'get',
})
}





/* -------填报进度详情-------*/
export function reportProgressDetail(taskId) {
    return Request({
        url: `${business}ddpartmentalOpinion/findById/${taskId}/1`,
        method: 'get',
    })
}
/* -------填报进度详情 附件信息-------*/
export function reportProgressFiles(ids) {
    return Request({
        url: `${files}/file/findByIds?ids=${ids}`,
        method: 'get',
    })
}

/* -------行政主体-------*/
export function getXZMenu() {
    return Request({
        //  url: `${selectUrl}department/findDeptByUnit/1`,
        url: `${User}/department/findDeptByUnit/1`,
        method: 'get'
    })
}

/* -------自评审核-------*/

// 查询部门
export function searchBranch(code) {
    return Request({
        url: `${business}respUser/findByDeptName/${code}`,
        method: 'post'
    })
}

// 列表查询
export function taskList(data) {
    return Request({
        url: `${business}examinationTask/findByPage/${data.page}/${data.size}`,
        method: 'post',
        data: data
    })
}
// 考核目标任务保存
export function taskSave(data) {
    return Request({
        url: `${business}examinationTask/save`,
        method: 'post',
        data: data
    })
}
// 考核目标任务更新
export function taskUpdate(data) {
    return Request({
        url: `${business}examinationTask/updateZpbm`,
        method: 'post',
        data: data
    })
}

// 考核目标任务查看明细
export function checkTargetTask(id) {
    return Request({
        url: `${business}examinationTask/findById/${id}`,
        method: 'get'
    })
}

// 根据id查询明细
export function responsibilityId(id) {
    return Request({
        url: `${business}responsibility/findByIds/${id}`,
        method: 'get'
    })
}

// 填报进度明细
export function deptOpinionProcess(taskId, type) {
    return Request({
        url: `${business}/ddpartmentalOpinion/findById/${taskId}/${type}`,
        method: 'get'
    })
}

// 所属地区
export function getTree(bizType, orgType, orgId) {
    return Request({
        url: `${rootLiwai}/org/getAllOrgDescendantsTree/${bizType}/${orgType}/${orgId}`,
        method: 'get'
    })
}

// 根据id查询牵头内容接口
export function findByTaskId(taskId) {
    return Request({
        url: `${business}dpartmentalOpinion/findByTaskId/${taskId}`,
        method: 'get'
    })
}


//省长责任制上传excel
export function uploadExcelFile(data,file) {
  return Request({
    url: `${business}examinationExcel/upload/${data.year}/${data.responsibilityId}`,
    method: 'post',
    data: file
  })
}

//获取省市
export function getDataTree() {
  return Request({
    url: `${business}respUser/getDataTree`,
    method: 'get',
  })
}

//自评部门上传excel
export function uploadSelf(data,file) {
  return Request({
    url: `${business}examinationExcel/uploadSelf/${data.year}/${data.responsibilityId}`,
    method: 'post',
      data: file
  })
}


export function ifUpload(year) {
  return Request({
    url: `${business}examinationExcel/ifUpload/${year}`,
    method: 'get',

})
}



