import { request } from '@umijs/max';


export default {
    //创建配方
    Add(parms: RecipeTypes.Info) {
        return request('/api/recipesinfo/add', {
            method: 'POST',
            data: {
                ...parms,
            },
        });
    },
    //删除
    Del(parms: RecipeTypes.Info) {
        return request(`/api/recipesinfo/del`, {
            method: 'POST',
            data: {
                ...parms,
            },
        });
    },

    //修改角色
    Update(parms: RecipeTypes.Info) {
        return request('/api/recipesinfo/update', {
            method: 'POST',
            data: {
                ...parms,
            },
        });
    },


    //获取角色列表
    List() {
        return request('/api/recipesinfo/list', {
            method: 'GET',
        });
    },

    /**
     * 角色分页查询
     * @param parms 
     * @returns 
     */
    PagedList(parms: RecipeTypes.Page) {
        return request('/api/recipesinfo/pagedlist', {
            method: 'POST',
            data: {
                ...parms,
            },
        });
    },
     /**
     * 获取配方物料列表
     * @param parms 
     * @returns 
     */
    MaterialList(parms:RecipeMaterialTypes.Info ){
        return request('/api/recipematerial/list', {
            method: 'POST',
            data: {
                ...parms,
            },
        });
    }, 
    //批量创建物料信息
    BatchAdd(parms: RecipeMaterialTypes.Info[]){
        return request('/api/recipematerial/batchadd', {
            method: 'POST',
            data: parms
        });
    },
    //更改分组
    ChangeGroup(parms: RecipeTypes.RecipesGroupInput){
        return request('/api/recipesinfo/changegroup', {
            method: 'POST',
            data: parms
        });
    },
     // 下拉
     selectlist() {
        return request('/api/recipesinfo/selectlist', {
            method: 'GET',

        })
    }
}

