import { SalePrice } from "@/api/interface/index";
import { CommonDynamicSelect } from "@/api/modules/common";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

export const getPriceList = () => {
  return http.post<SalePrice.ResPriceList>(PORT1 + `/GetPriceList`, {});
};

/**
 * @name 获取 部门列表
 */
export const getDeptList = (params: any) => {
  let queryParams = {};
  let newParams = JSON.parse(JSON.stringify(params));
  newParams.dsname = "web_deptlist";
  newParams.queryparams = queryParams;
  newParams.pageNum && (newParams.pageindex = newParams.pageNum);
  newParams.pageSize && (newParams.pagesize = newParams.pageSize);
  return CommonDynamicSelect(newParams, "web_deptlist");
};

/**
 * @name 保存 部门信息
 */
export const SaveDept = (params: SalePrice.ReqSaveDept) => {
  return http.post<SalePrice.ResSaveDept>(PORT1 + `/SaveDept`, params);
};

/**
 * @name 删除 部门信息
 */
export const DelteDept = (params: SalePrice.ReqDeleteDept) => {
  return http.post<SalePrice.ResDeleteDept>(PORT1 + `/DeleteDept`, params);
};

/**
 * @name 获取 工厂利润率
 */
export const getProfitRateList = (params: any) => {
  let queryParams = {};
  let newParams = JSON.parse(JSON.stringify(params));
  newParams.dsname = "web_factory_profitratelist";
  newParams.queryparams = queryParams;
  newParams.kind = newParams.kind;
  newParams.pageNum && (newParams.pageindex = newParams.pageNum);
  newParams.pageSize && (newParams.pagesize = newParams.pageSize);
  return CommonDynamicSelect(newParams, "web_factory_profitratelist");
};

/**
 * @name 保存 工厂利润率
 */
export const SaveProfitRate = (params: SalePrice.ReqSaveProfitrate) => {
  return http.post<SalePrice.ResSaveProfitrate>(PORT1 + `/SaveProfitrate`, params);
};
