/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2022-12-21 11:13:51
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2025-02-10 11:31:01
 * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlyInfoCheck/service.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */




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




//获取树结构单元数据

export type getTreeDataRespType = {
    code: number;
    name: string;
    child: getTreeDataRespType[]
}

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

    return request<getTreeDataRespType[]>('/performance/check/getUnitList', {
        method: 'GET',
        params: { computeDate }
    })
}



//获取人员信息表格数据

export type getPersonInfoTableDataParamsType = {
    computeDate: string; //核算年月
    unitCode: string; //核算单元代码
    empInfo?: string; //人员信息 （工号、姓名）
    current: number;
    pageSize: number;
}

export type PersonInfoType = {

    unitCode: number;
    empNo: string;
    empName: string;
    jobLevel: string;
    jobTitle: string;
    jobRate: string;
    seniority: string;

}

export type PersonInfoTableDataType = {
    current: number,
    list: PersonInfoType[],
    pageSize: number,
    totalCount: number,
    totalPage: number,
}

export const getPersonInfoTableData = (params: getPersonInfoTableDataParamsType) => {

    return request<PersonInfoTableDataType>('/performance/check/empList', {
        method: 'GET',
        params: { ...params }
    })

}


//获取科室信息表格数据

export type getDepInfoTableDataParamsType = {
    computeDate: string; //核算年月
    unitCode: string; //核算单元代码
    deptName?: string; //科室名称
}

export type DepInfoTableItemDataType = {
    unitCode: number,
    empNo: string,
    empName: string,
    jobLevel: string,
    jobTitle: string,
    jobRate: string,
    seniority: string
}

export type DepInfoTableDataType = {

    current: number,
    list: DepInfoTableItemDataType[],
    pageSize: number,
    totalCount: number,
    totalPage: number,
}

export const getDepInfoTableData = (params: getDepInfoTableDataParamsType) => {

    return request<DepInfoTableDataType>('/performance/check/deptList', {
        method: 'GET',
        params: params
    })

}


//获取收费项目信息

export type getProjectInfoTableDataParamsType = {
    computeDate: string; //核算年月
    unitCode: string; //核算单元代码
    itemName?: string; //项目名称
}

export type ProjectInfoTableItemDataType = {
    itemCode: string,
    itemName: string,
    itemType: string,
    itemPoint: number,
    coreFlag: string,
}

export type ProjectInfoTableDataType = {

    current: number,
    list: ProjectInfoTableItemDataType[],
    pageSize: number,
    totalCount: number,
    totalPage: number,
}

export const getProjectInfoTableData = (params: getProjectInfoTableDataParamsType) => {

    return request<ProjectInfoTableDataType>('/performance/check/itemList', {
        method: 'GET',
        params: params
    })

}


//获取收费项目信息表格数据

export type getChargeItemTableDataParamsType = {
    Date: string; //核算年月
    unitCode: string; //核算单元代码
    deptName?: string; //科室名称
}

export const getChargeItemfoTableData = (params: getDepInfoTableDataParamsType) => {

    return request<getTreeDataRespType>('/performance/check/itemList', {
        method: 'GET',
        params: params
    })

}


//获取可选人员列表

///master/centerSys/user/list

export const getTotalEmps = (params:{
    computeDate:string,
    unitCode:string
}) => {

    return request('/performance/check/getComputeEmployee', {
        method: 'GET',
        params: params
    })

}


//删除人员
export const delPersonRequest = (params:{
    computeDate:string,
    id:string
}) => {

    return request('/performance/check/deleteEmployee', {
        method: 'POST',
        params: params
    })

}


//生成数据

export type GenerateDataRequestParamsType = {
    computeDate: string,
    generateType: number,
}

export const generateDataRequest = (data: GenerateDataRequestParamsType) => {
 
    return request('/performance/check/generate', {
        method: 'POST',
        params:data
    })

}


//审核请求

export type CheckRequestParamsType = {
    computeDate:string,
    auditType:string
}
export const checkRequest = (data:CheckRequestParamsType) => {
 
    return request('/performance/check/audit', {
        method: 'POST',
        params:data
    })

}

//保存添加的人员

export const saveEmpsRequest = (data:any[]) => {
 
    return request('/performance/check/addComputeEmployee', {
        method: 'POST',
        data:data
    })

}

//绩效数据导入

export const jixiaoDataImport = (compute_date:string) => {
 
    return request('/performance/check/kpiImport', {
        method: 'POST',
        data:{
            parameter:{
                compute_date
            }
        }
    })

}

//异动信息获取
export const  getTransactionInfo = (compute_date:string) => {
 
    return request('/performance/check', {
        method: 'POST',
        params:{
            computeDate:compute_date
        }
    })

}

//获取展示哪一种样式参数
export const  getParams = () => {
 
    return request('/performance/parameter/getList?current=1&pageSize=500', {
        method: 'GET'
    })

}

//获取所有核算单元
export const  getAllCheckUnit = () => {
 
    return request('/performance/kpi/getUnitList', {
        method: 'GET'
    })

}

//快捷对照人员科室
export const  fastMapDepAndEmp = (data:{
    unitInfo:any[],
    mapType:number,
    messageCode:string,
    messageName:string
}) => {
 
    return request('/performance/check/fastMap', {
        method: 'POST',
        data
    })

}

//编辑人员信息  
export const  editEmpInfoReq = (data:any) => {
 
    return request('/performance/check/editComputeEmployee', {
        method: 'POST',
        data
    })

}

//获取备注模板
export const  getRemarkTempList = () => {
 
    return request('/performance/dict/getDictDataList?current=1&pageSize=10&typeCode=EMPLOYEE_REMARK_TEMP', {
        method: 'GET',
    })

}


