另存为模板功能
This commit is contained in:
@ -108,6 +108,7 @@ const mutations = {
|
||||
|
||||
const actions = {
|
||||
async init({ commit, dispatch }, payload) {
|
||||
//
|
||||
// console.log(payload);
|
||||
const planResponse = await getRecipesPlan(payload.planId);
|
||||
const {
|
||||
@ -262,8 +263,8 @@ const actions = {
|
||||
async saveRecipes({ commit, dispatch, state }, payload) {
|
||||
const { recipesData, cusId, planId } = state;
|
||||
const params = {
|
||||
cusId,
|
||||
planId,
|
||||
cusId: payload.cusId !== undefined ? payload.cusId : cusId,
|
||||
planId: payload.planId || planId,
|
||||
menus: recipesData.map((menu, idx) => ({
|
||||
numDay: menu.numDay,
|
||||
cusId,
|
||||
@ -284,8 +285,11 @@ const actions = {
|
||||
const result = await addRecipesApi(params);
|
||||
if (result.code === 200) {
|
||||
const recipesId = result.data;
|
||||
commit("updateStateData", { recipesId });
|
||||
dispatch("getRecipesInfo", { recipesId });
|
||||
if (!payload.planId) {
|
||||
// 非保存模板
|
||||
commit("updateStateData", { recipesId });
|
||||
dispatch("getRecipesInfo", { recipesId });
|
||||
}
|
||||
payload.callback &&
|
||||
payload.callback({
|
||||
name: state.name,
|
||||
|
Reference in New Issue
Block a user