修复未生成食谱逻辑错误
This commit is contained in:
@ -5,7 +5,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'App'
|
||||
}
|
||||
import { createNamespacedHelpers } from "vuex";
|
||||
const { mapActions } = createNamespacedHelpers("global");
|
||||
export default {
|
||||
name: "App",
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(["init"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -6,6 +6,7 @@ import tagsView from "./modules/tagsView";
|
||||
import permission from "./modules/permission";
|
||||
import settings from "./modules/settings";
|
||||
import recipes from "./modules/recipes";
|
||||
import global from "./modules/global";
|
||||
|
||||
import getters from "./getters";
|
||||
|
||||
@ -18,7 +19,8 @@ const store = new Vuex.Store({
|
||||
tagsView,
|
||||
permission,
|
||||
settings,
|
||||
recipes
|
||||
recipes,
|
||||
global
|
||||
},
|
||||
getters
|
||||
});
|
||||
|
62
stdiet-ui/src/store/modules/global.js
Normal file
62
stdiet-ui/src/store/modules/global.js
Normal file
@ -0,0 +1,62 @@
|
||||
import { getOptions } from "@/api/custom/order";
|
||||
|
||||
const oriState = {
|
||||
nutritionistIdOptions: [],
|
||||
nutriAssisIdOptions: [],
|
||||
preSaleIdOptions: [],
|
||||
afterSaleIdOptions: [],
|
||||
plannerIdOptions: [],
|
||||
plannerAssisIdOptions: [],
|
||||
operatorIdOptions: [],
|
||||
operatorAssisIdOptions: [],
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
save(state, payload) {
|
||||
Object.keys(payload).forEach(key => {
|
||||
state[key] = payload[key];
|
||||
});
|
||||
},
|
||||
clean(state) {
|
||||
Object.keys(oriState).forEach(key => {
|
||||
state[key] = oriState[key];
|
||||
});
|
||||
}
|
||||
};
|
||||
const actions = {
|
||||
async init({ commit }, payload) {
|
||||
const { data: optionsData } = await getOptions();
|
||||
const options = optionsData.reduce((opts, cur) => {
|
||||
if (!opts[cur.postCode]) {
|
||||
opts[cur.postCode] = [
|
||||
// { dictValue: null, dictLabel: "全部", remark: null }
|
||||
];
|
||||
}
|
||||
opts[cur.postCode].push({
|
||||
dictValue: cur.userId,
|
||||
dictLabel: cur.userName,
|
||||
remark: cur.remark
|
||||
});
|
||||
return opts;
|
||||
}, {});
|
||||
commit("save", {
|
||||
nutritionistIdOptions: options["nutri"] || [],
|
||||
nutriAssisIdOptions: options["nutri_assis"] || [],
|
||||
preSaleIdOptions: options["pre_sale"] || [],
|
||||
afterSaleIdOptions: options["after_sale"] || [],
|
||||
plannerIdOptions: options["planner"] || [],
|
||||
plannerAssisIdOptions: options["planner_assis"] || [],
|
||||
operatorIdOptions: options["operator"] || [],
|
||||
operatorAssisIdOptions: options["operator_assis"] || []
|
||||
});
|
||||
}
|
||||
};
|
||||
const getters = {};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: Object.assign({}, oriState),
|
||||
mutations,
|
||||
actions,
|
||||
getters
|
||||
};
|
@ -1,4 +1,3 @@
|
||||
import { getOrder } from "@/api/custom/order";
|
||||
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
||||
import { dealHealthy } from "@/utils/healthyData";
|
||||
import {
|
||||
@ -54,7 +53,7 @@ const mutations = {
|
||||
// console.log(payload);
|
||||
state.recipesData[payload.num].dishes = state.recipesData[
|
||||
payload.num
|
||||
].dishes.filter(obj => obj.id !== payload.dishesId);
|
||||
].dishes.filter(obj => obj.id !== payload.id);
|
||||
},
|
||||
updateStateData(state, payload) {
|
||||
Object.keys(payload).forEach(key => {
|
||||
@ -92,7 +91,7 @@ const actions = {
|
||||
commit("updateStateData", { dishesTypeOptions: response.data });
|
||||
});
|
||||
|
||||
//
|
||||
// 健康数据
|
||||
if (payload.cusId) {
|
||||
dispatch("getHealthyData", payload);
|
||||
}
|
||||
@ -104,7 +103,6 @@ const actions = {
|
||||
},
|
||||
async getHealthyData({ commit }, payload) {
|
||||
commit("updateStateData", { healthDataLoading: true });
|
||||
// 健康数据
|
||||
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
|
||||
payload.cusId
|
||||
);
|
||||
@ -211,7 +209,9 @@ const actions = {
|
||||
};
|
||||
const result = await addRecipesApi(params);
|
||||
if (result.code === 200) {
|
||||
dispatch("getRecipesInfo", { recipesId: result.data });
|
||||
const recipesId = result.data;
|
||||
commit("updateStateData", { recipesId });
|
||||
dispatch("getRecipesInfo", { recipesId });
|
||||
}
|
||||
// console.log(params);
|
||||
},
|
||||
@ -238,10 +238,10 @@ const actions = {
|
||||
payload.data.id = result.data;
|
||||
commit("addRecipesDishes", payload);
|
||||
}
|
||||
} else {
|
||||
commit("addRecipesDishes", payload);
|
||||
}
|
||||
// console.log(result);
|
||||
} else {
|
||||
commit("addRecipesDishes", payload);
|
||||
}
|
||||
},
|
||||
async updateDishes({ commit, state }, payload) {
|
||||
|
@ -43,11 +43,11 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="proteinRatio"
|
||||
label="蛋白质/100g"
|
||||
label="P/100g"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column prop="fatRatio" label="脂肪/100g" align="center" />
|
||||
<el-table-column prop="carbonRatio" label="碳水/100g" align="center" />
|
||||
<el-table-column prop="fatRatio" label="F/100g" align="center" />
|
||||
<el-table-column prop="carbonRatio" label="C/100g" align="center" />
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item label="推荐人群">
|
||||
|
@ -92,7 +92,7 @@ export default {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
console.log(data);
|
||||
// console.log(data);
|
||||
this.selDishes = data;
|
||||
this.active = 1;
|
||||
this.typeOptions = data.type.split(",").reduce((arr, cur, idx) => {
|
||||
@ -143,7 +143,7 @@ export default {
|
||||
type,
|
||||
igdList,
|
||||
});
|
||||
console.log(this.selDishes);
|
||||
// console.log(this.selDishes);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -296,13 +296,14 @@ export default {
|
||||
});
|
||||
},
|
||||
handleOnDishesConfirm(data) {
|
||||
// console.log(data);
|
||||
this.addDishes({
|
||||
num: this.num - 1,
|
||||
data,
|
||||
});
|
||||
},
|
||||
...mapActions(["updateDishes", "addDishes", "deleteDishes"]),
|
||||
...mapMutations(["setCurrentDay",]),
|
||||
...mapMutations(["setCurrentDay"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -111,14 +111,14 @@
|
||||
:data="recipesPlanList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
label="客户手机号"
|
||||
align="center"
|
||||
prop="hidePhone"
|
||||
width="180"
|
||||
/>
|
||||
/> -->
|
||||
<el-table-column
|
||||
label="食谱日期范围"
|
||||
align="center"
|
||||
@ -236,8 +236,7 @@
|
||||
|
||||
<!-- 查看完整计划 -->
|
||||
<el-dialog
|
||||
title="食谱计划表"
|
||||
v-if="allRecipesPlanOpen"
|
||||
:title="allRecipesPlanTitle"
|
||||
:visible.sync="allRecipesPlanOpen"
|
||||
width="800px"
|
||||
append-to-body
|
||||
@ -269,7 +268,7 @@
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="allRecipesPlanList" width="700px">
|
||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
||||
<!-- <el-table-column label="客户姓名" align="center" prop="customer" /> -->
|
||||
<!--<el-table-column label="营养师名称" align="center" prop="nutritionist" />
|
||||
<el-table-column label="营养师助理名称" align="center" prop="nutritionistAssis" />-->
|
||||
|
||||
@ -313,9 +312,9 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看订单 -->
|
||||
<order-dialog ref="orderDialog" />
|
||||
<!-- <order-dialog ref="orderDialog" /> -->
|
||||
<!-- 查看体征 -->
|
||||
<body_sign_dialog ref="bodySignDialog" />
|
||||
<!-- <body_sign_dialog ref="bodySignDialog" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -327,8 +326,8 @@ import {
|
||||
updateRecipesPlan,
|
||||
} from "@/api/custom/recipesPlan";
|
||||
import { getOptions } from "@/api/custom/order";
|
||||
import OrderDetail from "@/components/OrderDetail";
|
||||
import BodySignDetail from "@/components/BodySignDetail";
|
||||
// import OrderDetail from "@/components/OrderDetail";
|
||||
// import BodySignDetail from "@/components/BodySignDetail";
|
||||
import dayjs from "dayjs";
|
||||
import store from "@/store";
|
||||
|
||||
@ -378,6 +377,7 @@ export default {
|
||||
allRecipesPlanList: [],
|
||||
//订单弹窗状态
|
||||
allRecipesPlanOpen: false,
|
||||
allRecipesPlanTitle: '',
|
||||
//订单弹窗中查询参数
|
||||
allRecipesPlanQueryParam: {
|
||||
pageNum: 1,
|
||||
@ -394,8 +394,8 @@ export default {
|
||||
};
|
||||
},
|
||||
components: {
|
||||
"order-dialog": OrderDetail,
|
||||
body_sign_dialog: BodySignDetail,
|
||||
// "order-dialog": OrderDetail,
|
||||
// body_sign_dialog: BodySignDetail,
|
||||
},
|
||||
created() {
|
||||
getOptions().then((response) => {
|
||||
@ -476,6 +476,7 @@ export default {
|
||||
dayjs(item.endDate).format("YYYY-MM-DD");
|
||||
});
|
||||
this.allRecipesPlanOpen = true;
|
||||
this.allRecipesPlanTitle = `「${this.allRecipesPlanList[0].customer}」食谱计划表`
|
||||
this.allRecipesPlanTotal = response.total;
|
||||
});
|
||||
},
|
||||
|
Reference in New Issue
Block a user