/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2022-12-15 15:14:12
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-07-21 17:45:14
 * @FilePath: /BudgetManaSystem/src/pages/Home/service.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

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





//月度结转接口数据获取

export type getMonthlyDataRespType = {
    preCarry:{
        computeDate:string;  //核算年月
        beginDate:string;  //开始时间
        endDate:string;//结束时间
        personalRate:string; //人事成本比例
        seniority:number; //年资
        status:number;
    },
    currentCarry:{
        computeDate:string;  //核算年月
        beginDate:string;  //开始时间
        endDate:string;//结束时间
        personalRate:string; //人事成本比例
        seniority:number; //年资
        status:number;
    },
    lastCarry:{
        computeDate:string;  //核算年月
        beginDate:string;  //开始时间
        endDate:string;//结束时间
        personalRate:string; //人事成本比例
        seniority:number; //年资
        status:number;
    }
}

export const getMonthlyData = (getMonthlyDataParamType:string)=>{

       return request<getMonthlyDataRespType>('/performance/carry/list', {
            method:'GET',
            params:{computeDate:getMonthlyDataParamType},
       })
}


//结转请求

export const jiezhuanRequest = (computeDate:string)=>{

    return request('/performance/carry/over', {
         method:'POST',
         params:{computeDate},
    })
}

//开帐请求

export const kaizhnagRequest = (computeDate:string)=>{

    return request('/performance/carry/openBill', {
         method:'POST',
         params:{computeDate},
    })
}

//当前结转年月编辑

export type EditSaveRequestBodyType = {
    computeDate:string,
    beginDate:string,
    endDate:string,
    personalRate:string,
    seniority:string
}

export const editSave = (data:EditSaveRequestBodyType)=>{

    return request('/performance/carry/edit', {
         method:'POST',
         data,
    })
}

//结转回退

export const jiezhuanGoBack = (params:string)=>{

    return request('/performance/carry/back', {
         method:'POST',
         params:{computeDate:params},
    })
}

//获取核算年月结转状态
export const getJiezhuanStatus = (computeDate:string)=>{

    return request('/performance/carry/getBillStatus', {
         method:'GET',
         params:{computeDate},
    })
}




