diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java
index bb4236852..02f239ff9 100644
--- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java
@@ -36,6 +36,7 @@ public class SysWapController extends BaseController {
/**
* 获取用户信息
+ *
* @param outId
* @return
*/
@@ -46,6 +47,7 @@ public class SysWapController extends BaseController {
/**
* 获取某天食谱菜品
+ *
* @param id
* @return
*/
@@ -56,6 +58,7 @@ public class SysWapController extends BaseController {
/**
* 系统字典
+ *
* @param dictType
* @return
*/
@@ -63,4 +66,14 @@ public class SysWapController extends BaseController {
public AjaxResult sysDict(@PathVariable String dictType) {
return AjaxResult.success(iSysDictTypeService.selectDictDataByType(dictType));
}
+
+ /**
+ * 获取完整食谱
+ * @param id
+ * @return
+ */
+ @GetMapping(value = "recipes/{id}")
+ public AjaxResult recipesDetail(@PathVariable Long id) {
+ return AjaxResult.success(iSysRecipesService.selectSysRecipesByRecipesId(id));
+ }
}
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlanListInfo.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlanListInfo.java
index f82fd751b..926e9925c 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlanListInfo.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlanListInfo.java
@@ -11,6 +11,8 @@ public class SysRecipesPlanListInfo {
private Long id;
+ private Long recipesId;
+
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startDate;
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml
index 4c2d153a3..4ce1ed6ab 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml
@@ -234,6 +234,7 @@
+
diff --git a/stdiet-ui/src/api/custom/recipesShow.js b/stdiet-ui/src/api/custom/recipesShow.js
index 5f72315c6..70a9de050 100644
--- a/stdiet-ui/src/api/custom/recipesShow.js
+++ b/stdiet-ui/src/api/custom/recipesShow.js
@@ -1,6 +1,5 @@
import request from "@/utils/request";
-
export function getRecipesPlans(id) {
return request({
url: "/wap/recipes/plans/" + id,
@@ -40,3 +39,13 @@ export function getDicts(id) {
}
});
}
+
+export function getRecipesFullInfo(id) {
+ return request({
+ url: "/wap/recipes/" + id,
+ method: "get",
+ headers: {
+ isToken: false
+ }
+ });
+}
diff --git a/stdiet-ui/src/store/modules/recipesShow.js b/stdiet-ui/src/store/modules/recipesShow.js
index 84a1d3529..e149dc2c2 100644
--- a/stdiet-ui/src/store/modules/recipesShow.js
+++ b/stdiet-ui/src/store/modules/recipesShow.js
@@ -1,9 +1,18 @@
+import { getRecipesFullInfo, getDicts } from "@/api/custom/recipesShow";
+
const oriState = {
recipes: {},
- shoppingCart: {}
+ cusUnitDict: {},
+ cusWeightDict: {},
+ menuTypeDict: {},
+ idgTypeDict: {}
};
const mutations = {
+ setRecipesData(state, payload) {
+ // console.log(payload);
+ state.recipes[payload.recipesId] = payload.data;
+ },
updateStateData(state, payload) {
Object.keys(payload).forEach(key => {
state[key] = payload[key];
@@ -17,8 +26,97 @@ const mutations = {
};
const actions = {
- async fetchFullRecipes({commit, dispatch},payload ) {
-
+ async init({ commit, dispatch }, payload) {
+ getDicts("cus_cus_unit").then(response => {
+ const cusUnitDict = response.data.reduce((obj, cur) => {
+ obj[cur.dictValue] = cur.dictLabel;
+ return obj;
+ }, {});
+ commit("updateStateData", { cusUnitDict });
+ });
+ getDicts("cus_cus_weight").then(response => {
+ const cusWeightDict = response.data.reduce((obj, cur) => {
+ obj[cur.dictValue] = cur.dictLabel;
+ return obj;
+ }, {});
+ commit("updateStateData", { cusWeightDict });
+ });
+ getDicts("cus_dishes_type").then(response => {
+ const menuTypeDict = response.data.reduce((obj, cur) => {
+ obj[cur.dictValue] = cur.dictLabel;
+ return obj;
+ }, {});
+ commit("updateStateData", { menuTypeDict });
+ });
+ getDicts("cus_ing_type").then(response => {
+ const idgTypeDict = response.data.reduce((obj, cur) => {
+ obj[cur.dictValue] = cur.dictLabel;
+ return obj;
+ }, {});
+ commit("updateStateData", { idgTypeDict });
+ });
+ },
+ async fetchFullRecipes({ commit, dispatch }, payload) {
+ return new Promise((res, rej) => {
+ getRecipesFullInfo(payload.recipesId).then(response => {
+ if (response.code === 200) {
+ commit("setRecipesData", {
+ recipesId: payload.recipesId,
+ data: response.data.reduce((outArr, dayData, idx) => {
+ outArr.push({
+ id: dayData.id,
+ numDay: dayData.numDay,
+ dishes: dayData.dishes.reduce((arr, cur) => {
+ if (
+ cur.dishesId > -1 &&
+ cur.name &&
+ cur.igdList.length > 0 &&
+ cur.type !== "0"
+ ) {
+ arr.push({
+ id: cur.id,
+ dishesId: cur.dishesId,
+ name: cur.name,
+ menuId: cur.menuId,
+ methods: cur.methods,
+ remark: cur.remark,
+ type: cur.type,
+ isMain: cur.isMain,
+ igdList: cur.igdList.reduce((igdArr, igdData) => {
+ if (igdData.id > 0) {
+ const tarDetail = cur.detail.find(
+ obj => obj.id === igdData.id
+ );
+ if (tarDetail) {
+ igdArr.push({
+ id: igdData.id,
+ name: igdData.name,
+ carbonRatio: igdData.carbonRatio,
+ fatRatio: igdData.fatRatio,
+ proteinRatio: igdData.proteinRatio,
+ cusUnit: tarDetail.cus_unit,
+ cusWeight: tarDetail.cus_weight,
+ weight: parseFloat(tarDetail.weight),
+ notRec: igdData.notRec,
+ rec: igdData.rec,
+ type: igdData.type
+ });
+ }
+ }
+ return igdArr;
+ }, [])
+ });
+ }
+ return arr;
+ }, [])
+ });
+ return outArr;
+ }, [])
+ });
+ }
+ res();
+ });
+ });
}
};
diff --git a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue
index 3743ef03e..ee45c848f 100644
--- a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue
+++ b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue
@@ -34,9 +34,15 @@
+
diff --git a/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue b/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue
index 13833aaaf..0cf280e99 100644
--- a/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue
+++ b/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue
@@ -21,7 +21,6 @@
{{ plan.label }}
handleOnShoppingPlanClick(e, plan)"
/>
@@ -42,11 +41,15 @@
+
+
+