export const getTypeParentNames = (val) => {
  if (val) {
    let value = val.replace(/\//g, ",");
    const arr = `${value}`.split(",");
    return arr[0];
  }
};

const statusMenu = [
  {
    value: 0,
    label: "初始化创建",
  },
  {
    value: 1,
    label: "入库单开单",
  },
  {
    value: 2,
    label: "已入库",
  },
  {
    value: 3,
    label: "出库单开单",
  },
  {
    value: 4,
    label: "已出库",
  },
  {
    value: 9,
    label: "已作废",
  },
];
export const getStatusName = (val) => {
  if (val) {
    return statusMenu.find((i) => i.value == val)?.label || "";
  }

  return "";
};
// 唯一码修改 生成想要的对象 切勿解构对象 会覆盖前值 数据错误
export const getDetail = (info) => {
    return {
        materialName: info.materialName,
        materialCode: info.materialCode,
        materialShortName: info.materialShortName,
        model: info.model,
        specification: info.specification,
        typeName: info.typeName,
        unitName: info.unitName,
        typeParentNames: info.typeParentNames,
        description: info.description,
        weight: info.weight,
        kgFactor: info.kgFactor,
        materialId:info.id,//物料id
    }


}