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

export const getUserList = () => {
  return http.post<Basicinfo.ResUserList>(PORT1 + `/GetUserList`, {});
};

export const saveUserList = (params: Basicinfo.ResUserList) => {
  return http.post<Basicinfo.ResSaveUserList>(PORT1 + `/SaveUserList`, params);
};

export const delUserList = (params: Basicinfo.ResUserList) => {
  return http.post<Basicinfo.ResUserList>(PORT1 + `/DelUserList`, params);
};

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

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

/**
 * @name 获取 床网类别定义列表
 */
export const getBedNetTypeList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_bednet_typelist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_bednet_typelist");
};

/**
 * @name 保存 床网类别定义
 */
export const SaveBedNetType = (params: Basicinfo.ReqSaveBedNetType) => {
  return http.post(PORT1 + `/SaveBedNetType`, params);
};

/**
 * @name 删除 床网类别定义
 */
export const DeleteBedNetType = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteBedNetType`, params);
};

/**
 * @name 获取 床垫类别定义列表
 */
export const getMattressTypeList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_mattress_typelist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_mattress_typelist");
};

/**
 * @name 保存 床垫类别定义
 */
export const SaveMattressType = (params: Basicinfo.ReqSaveMattressType) => {
  return http.post(PORT1 + `/SaveMattressType`, params);
};

/**
 * @name 删除 床垫类别定义
 */
export const DeleteMattressType = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/SaveMattressType`, params);
};

/**
 * @name 获取 床垫公式定义列表
 */
export const getMattressFormulaList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_mattress_formulalist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_mattress_formulalist");
};

/**
 * @name 保存 床垫公式定义
 */
export const SaveMattressFormula = (params: Basicinfo.ReqSaveMattressFormula) => {
  return http.post(PORT1 + `/SaveMattressFormula`, params);
};

/**
 * @name 删除 床垫公式定义
 */
export const DeleteMattressFormula = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteMattressFormula`, params);
};

/**
 * @name 获取 裥棉收缩率列表
 */
export const getShrinkageList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_shrinkagelist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_shrinkagelist");
};

/**
 * @name 保存 裥棉收缩率
 */
export const SaveShrinkage = (params: Basicinfo.ReqSaveShrinkage) => {
  return http.post(PORT1 + `/SaveShrinkage`, params);
};

/**
 * @name 删除 裥棉收缩率
 */
export const DeleteShrinkage = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteShrinkage`, params);
};

/**
 * @name 获取 弹簧资料列表
 */
export const getSpringList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_springlist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_springlist");
};

/**
 * @name 保存 弹簧资料
 */
export const SaveSpring = (params: Basicinfo.ReqSaveSpring) => {
  return http.post(PORT1 + `/SaveSpring`, params);
};

/**
 * @name 删除 弹簧资料
 */
export const DeleteSpring = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteSpring`, params);
};

/**
 * @name 审核 弹簧资料
 */
export const AuditSpring = (params: Basicinfo.ReqAuditSpring) => {
  return http.post(PORT1 + `/AuditSpring`, params);
};

/**
 * @name 获取 床网/床垫变量定义
 */
export const getBedNetVarList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_bednetvarlist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_bednetvarlist");
};

/**
 * @name 获取 床网/床垫变量明细定义
 */
export const getBedNetVarMxList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_bednetvarmxlist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_bednetvarmxlist");
};

/**
 * @name 获取 床网/床垫变量明细新建
 */
export const getBedNetVarMxNewList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_bednetvarmxnewlist";
  newParams.queryparams = params;
  return CommonDynamicSelect(newParams, "web_bednetvarmxnewlist");
};

/**
 * @name 保存 床网/床垫变量定义
 */
export const SaveBedNetVar = (params: Basicinfo.ReqSaveBedNetVar) => {
  return http.post(PORT1 + `/SaveBedNetVar`, params);
};

/**
 * @name 删除 床网/床垫变量定义
 */
export const DeleteBedNetVar = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteBedNetVar`, params);
};

/**
 * @name 获取 物料类别定义
 */
export const getMtrlType = () => {
  return http.post<Basicinfo.ResGetMtrlTypeList>(PORT1 + `/GetMtrlTypeList`, {});
};

/**
 * @name 保存 物料类别定义
 */
export const SaveMtrlType = (params: Basicinfo.ReqSaveMtrlType) => {
  return http.post(PORT1 + `/SaveMtrlType`, params);
};

/**
 * @name 删除 物料类别定义
 */
export const DeleteMtrlType = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteMtrlType`, params);
};

/**
 * @name 获取 物料资料定义
 */
export const getMtrlDefList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_mtrldeflist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_mtrldeflist");
};

/**
 * @name 保存 物料资料定义
 */
export const SaveMtrlDef = (params: Basicinfo.ReqSaveMtrlDef) => {
  return http.post(PORT1 + `/SaveMtrlDef`, params);
};

/**
 * @name 删除 物料资料定义
 */
export const DeleteMtrlDef = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteMtrlDef`, params);
};

/**
 * @name 禁用 物料资料定义
 */
export const BanMtrlDef = (params: Basicinfo.ReqBanBasicinfo) => {
  return http.post<Basicinfo.ResBanBasicinfo>(PORT1 + `/BanMtrlDef`, params);
};

/**
 * @name 获取 物料资料定义
 */
export const getMtrlPriceList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_mtrl_price_pricelist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_mtrl_price_pricelist");
};

/**
 * @name 获取 物料资料定义
 */
export const getMtrlPriceNewList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_mtrl_price_price_newlist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_mtrl_price_price_newlist");
};

/**
 * @name 获取 多维度定价列表
 */
export const getMultiPriceList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_multipricelist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_multipricelist");
};

/**
 * @name 保存 多维度定价
 */
export const SaveMultiPrice = (params: Basicinfo.ReqSaveMultiPrice) => {
  return http.post(PORT1 + `/SaveMultiPrice`, params);
};

/**
 * @name 删除 多维度定价
 */
export const DeleteMultiPrice = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteMultiPrice`, params);
};

/**
 * @name 禁用 多维度定价
 */
export const BanMultiPrice = (params: Basicinfo.ReqBanBasicinfo) => {
  return http.post<Basicinfo.ResBanBasicinfo>(PORT1 + `/BanMultiPrice`, params);
};

/**
 * @name 获取 多维度定价列表
 */
export const getBedNetAreaList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_bednet_arealist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_bednet_arealist");
};

/**
 * @name 保存 床网分区定义
 */
export const SaveBedNetArea = (params: Basicinfo.ReqSaveBedNetArea) => {
  return http.post(PORT1 + `/SaveBedNetArea`, params);
};

/**
 * @name 删除 床网分区定义
 */
export const DeleteBedNetArea = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteBedNetArea`, params);
};

/**
 * @name 获取 部件选配类型
 */
export const getConfigureTypeList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_configure_typelist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_configure_typelist");
};

/**
 * @name 保存 部件选配类型
 */
export const SaveConfigureType = (params: Basicinfo.ReqSaveConfigure) => {
  return http.post(PORT1 + `/SaveConfigureType`, params);
};

/**
 * @name 删除 部件选配类型
 */
export const DeleteConfigureType = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteConfigureType`, params);
};

/**
 * @name 获取 部件选配项
 */
export const getConfigureCodeList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_configure_codelist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_configure_codelist");
};

/**
 * @name 保存 部件选配项
 */
export const SaveConfigureCode = (params: Basicinfo.ReqSaveConfigure) => {
  return http.post(PORT1 + `/SaveConfigureCode`, params);
};

/**
 * @name 删除 部件选配项
 */
export const DeleteConfigureCode = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteConfigureCode`, params);
};

/**
 * @name 获取 部件选配项值
 */
export const getConfigureCodeMxList = (params: any) => {
  let newParams: any = {};
  newParams.dsname = "web_configure_codemxlist";
  newParams.queryparams = params;
  params.pageNum && (newParams.pageindex = params.pageNum);
  params.pageSize && (newParams.pagesize = params.pageSize);
  delete params.pageNum;
  delete params.pageSize;
  return CommonDynamicSelect(newParams, "web_configure_codemxlist");
};

/**
 * @name 保存 部件选配项值
 */
export const SaveConfigureCodeMx = (params: Basicinfo.ReqSaveConfigure) => {
  return http.post(PORT1 + `/SaveConfigureCodeMx`, params);
};

/**
 * @name 删除 部件选配项值
 */
export const DeleteConfigureCodeMx = (params: Basicinfo.ReqDeleteBasicinfo) => {
  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteConfigureCodeMx`, params);
};
