// 导入axios实例
import httpRequest from '@/request/index'
import md5 from 'js-md5'

// 导出数据接口
export function apiGetExportMsg(url, params) {
    return httpRequest({
        url: url,
        method: 'get',
        responseType: 'blob',
        params: params
    })
}
// 导出模版接口
export function apiGetModel(url, params) {
    return httpRequest({
        url: url,
        method: 'get',
        params: params
    })
}

//获取菜单数据
export function apiGetMenuData() {
    return httpRequest({
        url: 'menu/menuList?parentId=10105', // 测试
        // url: 'menu/menuList?parentId=6802', // 生产
        method: 'post'
    })
}
//获取权限数据
export function apiGetPrivilegesOfCurrentUserAll() {
    return httpRequest({
        url: 'menu/getPrivilegesOfCurrentUserAll',
        method: 'post'
    })
}

//----------------------------------------登录页接口------------------------------------------------
// 登录接口
export function loginApi(username,password) {
    // MD5 32 位
    return httpRequest({
      url: `user/bladeAuth?username=${username}&password=${md5(password)}`,
      method: 'post'
    })
}
// 根据token获取code
export function apiGetCodeByToken(params) {
    return httpRequest({
        url: `user/getCodeByToken?token=${params}`,
        method: 'get'
    })
}
// 获取用户信息
export function apiGetUserMsg(params) {
    return httpRequest({
        url: `user/getSysUser?code=${params}`,
        method: 'get'
    })
}

// 退出接口
export function apiPostremoveByToken(params) {
    return httpRequest({
        url: `user/removeByToken?token=${params}`,
        method: 'post'
    })
}


//----------------------------------------任务中心------------------------------------------------
//---------列表
export function apiPostTodoTaskList(params) {
    return httpRequest.post('workflow/todoTaskList', params)
}
//----------同意/拒绝审批
export function apiPostIsdoAction(params) {
    return httpRequest.post('workflow/isOkAction', params)
}
//----------根据流程ID获取业务ID
export function apiPostgetInstanceAndChildren(params) {
    return httpRequest({
        url: 'workflow/getInstanceAndChildren',
        method: 'post',
        params: params
    })
}
//----------任务处理-获取考评启动详情
export function apiGettaskevalStartDetail(params) {
    return httpRequest({
        url: 'dept-responsibility/getByidAndInfo',
        method: 'get',
        params: params
    })
}
//----------任务处理-获取考评启动详情
export function apiGettaskmothAyearDetail(params) {
    return httpRequest({
        url: 'organization-evaluation/getByidAndInfo',
        method: 'get',
        params: params
    })
}

//考评得分统计查询
export function apiGetscoreCountList(params) {
    return httpRequest({
        url: 'score_count/list',
        method: 'get',
        params: params
    })
}
//考评得分统计修改
export function apiPostScoreCountSave(params) {
    return httpRequest.post('score_count/save', params)
}


//----------------------------------------考评业务------------------------------------------------

//获取审批流程数据
export function apiGetworkflowgetOpinion(params) {
    return httpRequest({
        url: 'workflow/getOpinion',
        method: 'post',
        params: params
    })
}


//部门目标责任表
export function apiGetdeptresponsibilityList(params) {
    return httpRequest({
        url: 'dept-responsibility/list',
        method: 'get',
        params: params
    })
}
//----"部门目标责任表-保存or修改"
export function apiGetdeptresponsibilitySave(params) {
    return httpRequest.post('dept-responsibility/save', params)
}

//------考评启动（流程）
export function apiGetdoAction(params) {
    return httpRequest.post('workflow/doAction', params)
}
//  考评评价指标内容
export function apiGetOrganizationRule(params) {
    return httpRequest({
        url: 'organization-evaluation-rule/getOrganizationRule',
        method: 'get',
        params: params
    })
}


//------考评启动-生成
export function apiGetdeptresponsibilitygenerate(params) {
    return httpRequest({
        url: 'dept-responsibility/generate',
        method: 'post',
        params: params
    })
}
//------考评启动-详情
export function apiGetdeptresponDetail(params) {
    return httpRequest({
        url: 'responsibility-indicator-info/planValueList',
        method: 'get',
        params: params
    })
}
//------考评启动-详情-修改
export function apiGetindicatorsaveBatchDto(params) {
    return httpRequest.post('responsibility-indicator-info/saveBatchDto', params)
}
//----"考评启动-删除"
export function apiPostresponsiDelete(params) {
    return httpRequest({
        url: `dept-responsibility/remove/${params}`,
        method: 'post'
    })
}

//----单位/部门考评配置所有数据
export function apiGetOrganizationListAll(params) {
    return httpRequest({
        url: 'organization-evaluation-rule/listAll',
        method: 'get',
        params: params
    })
}
//月/季度考评列表查询
export function apiGetAssessmentList(params) {
    return httpRequest({
        url: 'assessment/list',
        method: 'get',
        params: params
    })
}
//月度目标考评页面和年度目标考评页面list
export function apiGetOrgEvaluationList(params) {
    return httpRequest({
        url: 'organization-evaluation/list',
        method: 'get',
        params: params
    })
}
//------生成报表
export function apiGetgenerateEvaluateReport(params) {
    return httpRequest({
        url: 'evaluate-report/generateEvaluateReport',
        method: 'post',
        params: params
    })
}
//------计算得分
export function apiGetcalculatorcron(params) {
    return httpRequest({
        url: 'calculator/cron',
        method: 'get',
        params: params
    })
}
//单位月度考评记录-生成
export function apiGetgenerateUnitMonthEvaluation(params) {
    return httpRequest({
        url: 'organization-evaluation/generateUnitMonthEvaluation',
        method: 'post',
        params: params
    })
}
//单位年度考评记录-生成
export function apiGetgenerateUnitYearEvaluation(params) {
    return httpRequest({
        url: 'organization-evaluation/generateUnitEvaluation',
        method: 'post',
        params: params
    })
}
//单位/部门（月 、年）考评记录-保存or修改 
export function apiPostOrgEvaSave(params) {
    return httpRequest.post('organization-evaluation/save', params)
}
//月/年考评指标明细
export function apiGetOrgEvalInfoList(params) {
    return httpRequest({
        url: 'organization-evaluation-info/finishValueList',
        method: 'get',
        params: params
    })
}
//------月/年考评-详情-修改
export function apiGetOrgEvaInfoBatchDto(params) {
    return httpRequest.post('organization-evaluation-info/saveBatchDto', params)
}
//----"月/年考评-删除"
export function apiPostOrgevaluationDelete(params) {
    return httpRequest({
        url: `organization-evaluation/remove/${params}`,
        method: 'post'
    })
}

//--------考评报告列表
export function apiGetEvalReportList(params) {
    return httpRequest({
        url: 'evaluate-report/list',
        method: 'get',
        params: params
    })
}
//--------考评报告列表
export function apiGetEvalReportinfoList(params) {
    return httpRequest({
        url: 'evaluate-report-info/list',
        method: 'get',
        params: params
    })
}

//----------------------------------------考评体系配置------------------------------------------------
//----考评指标管理
//----"指标-查询"
export function apiGetIndicatorList(params) {
    return httpRequest({
        url: 'indicator/list',
        method: 'get',
        params: params
    })
}
//----"指标类别-查询"
export function apiGetIndicatorTypeList() {
    return httpRequest({
        url: 'indicator-type/list',
        method: 'get',
    })
}
//----"指标-新增/修改"
export function apiGetIndicatorSave(params) {
    return httpRequest.post('indicator/save', params)
}
//----"指标-删除"
export function apiGetIndicatorDelete(params) {
    return httpRequest({
        url: `indicator/remove/${params}`,
        method: 'post'
    })
}

//----"指标项-查询"
export function apiGetIndicatordictionaryList(params) {
    return httpRequest({
        url: 'indicator-dictionary/listGroup',
        method: 'get',
        params: params
    })
}
//----"指标项-根据指标查询"
export function apiGetIndidicList(params) {
    return httpRequest({
        url: 'indicator-dictionary/list',
        method: 'get',
        params: params
    })
}
//----"指标项-保存/修改"
export function apiGetIndicatordicsaveList(params) {
    return httpRequest.post('indicator-dictionary/saveBatch', params)
}
//----"指标项-删除"
export function apiGetIndicatordicdeleteList(params) {
    return httpRequest({
        url: `indicator-dictionary/remove/${params}`,
        method: 'post'
    })
}
// 指标组合添加
export function apiPostindicatorsaveGroup(params) {
    return httpRequest.post('indicator/saveGroup', params)
}
// 根据指标id获取主子指标-list
export function apiGetIndidicselectById(params) {
    return httpRequest({
        url: 'indicator/selectById',
        method: 'get',
        params: params
    })
}


//----考评规则配置
//----考评规则-list
export function apiGetevaluateRuleList(params) {
    return httpRequest({
        url: 'evaluate-rule/list',
        method: 'get',
        params: params
    })
}
//----"规则-保存/修改"
export function apiGetevaluateRuleSaveList(params) {
    return httpRequest.post('evaluate-rule/save', params)
}
//----"规则-删除"
export function apiGetevaluateRuledeleteList(params) {
    return httpRequest({
        url: `evaluate-rule/remove/${params}`,
        method: 'post'
    })
}
//----"规则模块，规则阶段数据"
export function apiGetdatadictionaryList(params) {
    return httpRequest({
        url: 'data-dictionary/list',
        method: 'get',
        params: params
    })
}
//阶段
export function apiGetbinstageList(params) {
    return httpRequest({
        url: 'bin-stage/list',
        method: 'get',
        params: params
    })
}
//属性
export function apiGetbinsectionList(params) {
    return httpRequest({
        url: 'bin-section/list',
        method: 'get',
        params: params
    })
}
//---------"指标项条目-查询"
export function apiGetdataZBXList() {
    return httpRequest({
        url: 'data-dictionary/list?superKey=ZBX0001',
        method: 'get'
    })
}
//---------"部门"
export function apiGetdataBMList() {
    return httpRequest({
        url: 'data-dictionary/list?superKey=BM0001',
        method: 'get'
    })
}
//----考评规则详情-list
export function apiGetevaluateRuleinfoList(params) {
    return httpRequest({
        url: 'evaluate-rule-info/list',
        method: 'get',
        params: params
    })
}
//----"规则详情-保存/修改"
export function apiGetevaluateRuleInfoSaveList(params) {
    return httpRequest.post('evaluate-rule-info/save', params)
}
//----"规则详情-删除"
export function apiGetevaluateRuleinfodeleteList(params) {
    return httpRequest({
        url: `evaluate-rule-info/remove/${params}`,
        method: 'post'
    })
}
//----"规则详情中指标数据-list"
export function apiGetindicatorListAll(params) {
    return httpRequest({
        url: `indicator/listAll`,
        method: 'get',
        params: params
    })
}

//----单位/部门考评配置-list
export function apiGetOrganizationList(params) {
    return httpRequest({
        url: 'organization-evaluation-rule/list',
        method: 'get',
        params: params
    })
}
//----"单位/部门考评配置-保存/修改"
export function apiGetorganizationSaveList(params) {
    return httpRequest.post('organization-evaluation-rule/save', params)
}
//----"单位/部门考评配置-删除"
export function apiGetorganizationdeleteList(params) {
    return httpRequest({
        url: `organization-evaluation-rule/remove/${params}`,
        method: 'post'
    })
}
//----单位/部门考评配置  --查询规则
export function apiGetevaluateListAll(params) {
    return httpRequest({
        url: 'evaluate-rule/listAll',
        method: 'get',
        params: params
    })
}
//----根据组织树查询部门
export function apiGetorganizationstructureFromTree(params) {
    return httpRequest({
        url: 'organization-structure/getTree',
        method: 'get',
        params: params
    })
}

//----考评人员配置-list
export function apiGetpersonnelList(params) {
    return httpRequest({
        url: 'personnel-evaluation-rule/list',
        method: 'get',
        params: params
    })
}
//----"考评人员配置-保存/修改"
export function apiGetpersonnelSaveList(params) {
    return httpRequest.post('personnel-evaluation-rule/save', params)
}
//----"考评人员配置-删除"
export function apiGetpersonneldeleteList(params) {
    return httpRequest({
        url: `personnel-evaluation-rule/remove/${params}`,
        method: 'post'
    })
}
//-----组织结构-查询
export function apiGetorganizationgetTree(params) {
    return httpRequest({
        url: 'organization-structure/getTree',
        method: 'get',
        params: params
    })
}
//-----人员-查询
export function apiGetuserListAll(params) {
    return httpRequest({
        url: 'user/listAll',
        method: 'get',
        params: params
    })
}

//业绩考核系数配置
export function apiGetyeargroupcoefficientList(params) {
    return httpRequest({
        url: 'year-group-coefficient/list',
        method: 'get',
        params: params
    })
}
//----"业绩考核系数配置-保存/修改"
export function apiGetyeargroupcoefficientsaveGroup(params) {
    return httpRequest.post('year-group-coefficient/saveGroup', params)
}
//----"业绩考核系数配置-删除"
export function apiDeleteyearcoefficientRemove(params) {
    return httpRequest({
        url: `year-group-coefficient/remove/${params}`,
        method: 'post'
    })
}
//----年度经营业绩系数-查询byid
export function apigetyeargroupcoefficientlistById(params) {
    return httpRequest({
        url: `year-group-coefficient/listById`,
        method: 'get',
        params: params
    })
}

//党建乘数配置查询
export function apiGetpartybuildingList(params) {
    return httpRequest({
        url: 'party-building-multiplier/list',
        method: 'get',
        params: params
    })
}
//----党建乘数新增或修改
export function apiPostpartybuildSave(params) {
    return httpRequest.post('party-building-multiplier/save', params)
}
//----党建乘数配置删除
export function apiDeletepartyBuildRemove(params) {
    return httpRequest({
        url: `party-building-multiplier/remove/${params}`,
        method: 'post'
    })
}


//----------------------------------------考评知识库------------------------------------------------
//----考评得分规则列表查询-list
export function apiGetevaluationscoringruleList(params) {
    return httpRequest({
        url: 'evaluation-scoring-rule/list',
        method: 'get',
        params: params
    })
}
//----"考评得分规则-保存/修改"
export function apiGetevaluationscoringSaveList(params) {
    return httpRequest.post('evaluation-scoring-rule/saveOrUpdate', params)
}
//----"考评得分规则批量删除"
export function apiGetevaluationruleRemove(params) {
    return httpRequest({
        url: `evaluation-scoring-rule/remove/${params}`,
        method: 'post'
    })
}
//函数查询
export function apiGetfunctionList() {
    return httpRequest({
        url: 'function/list',
        method: 'get'
    })
}

//----区间评分详情查询-list
export function apiGetintervaltableList(params) {
    return httpRequest({
        url: 'interval-scoring-table/list',
        method: 'get',
        params: params
    })
}
// -------根据指标查询指标项
export function apiGetindicatorselectByCode(params) {
    return httpRequest({
        url: 'indicator/selectByCode',
        method: 'get',
        params: params
    })
}
//----"区间评分新增和修改"
export function apiGetintervalscoringsaveOrUpdate(params) {
    return httpRequest.post('interval-scoring-table/saveOrUpdate', params)
}
// //----"考评得分规则批量删除"
export function apiGetintervalscoringRemove(params) {
    return httpRequest({
        url: `interval-scoring-table/remove/${params}`,
        method: 'post'
    })
}
//----------------------------------------基础信息配置------------------------------------------------