/*
 * @Author: your name
 * @Date: 2021-07-26 08:54:08
 * @LastEditTime: 2021-07-30 18:45:42
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /TracerMethodology_PC/src/pages/DepartmentMana/service.js
 */

import { request } from 'umi';


//获取列表
export async function getCostshareparamConnectList(params, options) {
    const {shareParamName,current,pageSize} = params;
    return request('/api/costAccount/costaccountshare/list', {
      method: 'GET',
      params:{
          name:shareParamName,
          current,
          pageSize
      },
      ...(options || {}),
    });
}


//获取责任中心选择列表
export async function getResponsibilityCenterSelecterList(params, options) {
  // const {shareParamName,current,pageSize} = params;
  return request('/api/costAccount/responsibility/getLevelTwo', {
    method: 'GET',
    ...(options || {}),
  });
}

//编辑科室
export async function editCostshareparamConnectList(body, options) {
  return request('/api/costAccount/costaccountshare/update', {
    method: 'POST',
    data:{...body},
    ...(options || {}),
  });
}

//新增科室
export async function addCostshareparamConnect(body, options) {
  return request('/api/costAccount/costaccountshare/save', {
    method: 'POST',
    data:{...body},
    ...(options || {}),
  });
}

//删除科室
export async function delCostshareparamConnect(params, options) {
  const {id} = params;
  const ids = [id];
  return request(`/api/costAccount/costaccountshare/delete`, {
    method: 'POST',
    data:ids,
    ...(options || {}),
  });
}


//获取所有可选会计科目
export async function getAccountingSubjectForSelecter(params, options) {

  return request(`/api/costAccount/accounting/selectAccounting`, {
    method: 'GET',
    ...(options || {}),
  });
}

//获取当前成本已用本的分摊参数列表
export async function getHasSetParamsList(params, options) {
  const {id} = params;
  return request(`/api/costAccount/costaccountshare/getShareParamById`, {
    method: 'GET',
    params:{
         id:id
    },
    ...(options || {}),
  });

}


//获取添加分摊参数时可选列表
export async function getParamsSelectableList(params, options) {
  const {id} = params;
  console.log({params});
  return request(`/api/costAccount/costaccountshare/getAllShareParamStatusById`, {
    method: 'GET',
    params:{
         id:id
    },
    ...(options || {}),
  });

}


//保存成本分摊参数
export async function saveParamsList(params, options) {
  const {id,shareParamProportionVOList} = params;
  return request(`/api/costAccount/costaccountshare/updateShareParam`, {
    method: 'POST',
    data:{
         id,
         shareParamProportionVOList
    },
    ...(options || {}),
  });

}
