/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-01-04 13:59:26
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-07-12 17:44:22
 * @FilePath: /BudgetManaSystem/src/pages/budgetMana/personnelSalaryBudget/service.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */





import { request } from '@@/plugin-request';




//获取薪酬预算表格数据

export type getDataRespType = {
    income:number,
    cost:number,
    rate:number,
    personalCost:number,
    detail:[
        unitType:string,
        unitTypeName:string,
        percent:string,
        cost:string,
        salary:string,
        subsidies:string,
        variableCompensation:string,
        staffRate:string,
        averageSalary:number
    ]

}

export const getData = (computeDate:string,reportCode:number)=>{

    return request<getDataRespType>('/performance/first/getList', {
         method:'GET',
         params:{computeDate,reportCode}
    })
}


//获取审核状态
export const getCurrentCheckStatus = (computeDate:string)=>{
    return request('/performance/first/getStatus', {
        method:'GET',
        params:{computeDate}
   })
}

//获取当前职类审核状态
export const getCurrentZhileiCheckStatus = (computeDate:string,reportCode:string)=>{
    return request('/performance/first/getUnitTypeAuditStatus', {
        method:'GET',
        params:{computeDate,reportCode}
   })
}


//获取职类列表
export const getZhileiList = ()=>{
    return request('/performance/dict/getDictDataList?current=1&pageSize=500&typeCode=1', {
        method:'GET',
   })
}

//审核
export const checkRequest = (data:{computeDate:string,auditType:string,reportCode?:string},checkType:string)=>{

    if(checkType == '1'){
        return request('/performance/first/audit', {
            method:'POST',
            params:data
       })
    }
    if(checkType == '2'){
        return request('/performance/first/auditUnitType', {
            method:'POST',
            params:data
       })
    }
    
}



//计算
export const caculate = (computeDate:string)=>{
    return request('/performance/first/compute', {
        method:'POST',
        params:{computeDate}
   })
}

//获取审核方式
export const getCheckType = ()=>{
    return request(`/performance/parameter/getList?current=1&pageSize=10&parameterName=${'一次分配审核模式'}`, {
        method:'GET',
   })
}



