This commit is contained in:
xiezhijun 2021-03-13 11:41:30 +08:00
commit 20a30369bc
9 changed files with 200 additions and 39 deletions
stdiet-custom/src/main/resources/mapper/custom
stdiet-ui/src
components/RecipesPlanDrawer
store/modules
views/custom
recipesBuild
InfoView
RecipesView/RecipesHeaderCom
VerifyView
index.vue
recipesShow/PlanDrawer

@ -141,7 +141,7 @@
and (sc.name like concat('%',#{customer},'%') or sc.phone like concat('%',#{customer},'%'))
</if>
<if test="cusId != null and cusId != ''">and cus_id = #{cusId}</if>
<if test="phone != null and phone != ''">and phone = #{phone}</if>
<if test="phone != null and phone != ''">and sc.phone = #{phone}</if>
<if test="status != null ">and status = #{status}</if>
<if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if>
<if test="preSaleId != null ">and pre_sale_id = #{preSaleId}</if>

@ -118,6 +118,7 @@
<if test="orderId != null">order_id = #{orderId},</if>
<if test="cusId != null">cus_id = #{cusId},</if>
<if test="outId != null">out_id = #{outId},</if>
<if test="recipesId != null">recipes_id = #{recipesId},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="startNumDay != null">start_num_day = #{startNumDay},</if>

@ -90,7 +90,7 @@
{{ `${scope.row.startDate}${scope.row.endDate}` }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120">
<el-table-column label="操作" align="center" width="160">
<template slot-scope="scope">
<el-button
type="text"
@ -101,6 +101,13 @@
>
{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}
</el-button>
<el-button
v-if="scope.row.reviewStatus === 1"
type="text"
icon="el-icon-delete"
@click="handleOnDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@ -134,8 +141,8 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleOnCreateConfirm"
> </el-button
>
>
</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -145,7 +152,7 @@
<script>
import Clipboard from "clipboard";
import { listRecipesPlanByCusId } from "@/api/custom/recipesPlan";
import { addRecipesPlan } from "@/api/custom/recipesPlan";
import { addRecipesPlan, updateRecipesPlan } from "@/api/custom/recipesPlan";
import PlanPauseDrawer from "./PlanPauseDrawer";
import VueQr from "vue-qr";
import dayjs from "dayjs";
@ -269,6 +276,33 @@ export default {
this.open = false;
this.reset();
},
handleOnDelete(data) {
console.log(data);
this.$confirm("此操作将删除对计划的食谱, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
updateRecipesPlan({
id: data.id,
recipesId: 0,
reviewStatus: 0,
}).then((res) => {
if (res.code === 200) {
this.$message.success("删除成功");
this.getList();
}
});
})
.catch(() => {
// this.$message({
// type: "info",
// message: "",
// });
});
},
},
};
</script>

@ -34,8 +34,9 @@ const oriState = {
copyData: undefined,
canCopyMenuTypes: [],
fontSize: parseInt(localStorage.getItem("fontSize")) || 12,
dishBigClassOptions:[],
dishSmallClassOptions:[],
dishBigClassOptions: [],
dishSmallClassOptions: [],
leftShow: false
};
const mutations = {
@ -99,6 +100,9 @@ const mutations = {
state[key] = payload[key];
});
},
toggleLeftShow(state, payload) {
state.leftShow = !state.leftShow;
},
setDate(state, payload) {
state.startDate = payload.startDate;
state.endDate = payload.endDate;
@ -141,10 +145,10 @@ const actions = {
getDicts("cus_dishes_type").then(response => {
commit("updateStateData", { typeOptions: response.data });
});
getDicts("dish_class_big").then((response) => {
getDicts("dish_class_big").then(response => {
commit("updateStateData", { dishBigClassOptions: response.data });
});
getDicts("dish_class_small").then((response) => {
getDicts("dish_class_small").then(response => {
commit("updateStateData", { dishSmallClassOptions: response.data });
});
@ -467,16 +471,16 @@ const getters = {
const dishClass = [];
state.dishBigClassOptions.forEach((item, index) => {
dishClass.push({
'value': parseInt(item.dictValue),
'label': item.dictLabel,
'children': []
value: parseInt(item.dictValue),
label: item.dictLabel,
children: []
});
if(index == state.dishBigClassOptions.length - 1){
if (index == state.dishBigClassOptions.length - 1) {
state.dishSmallClassOptions.forEach((smallClass, i) => {
if(smallClass.remark){
dishClass[parseInt(smallClass.remark-1)].children.push({
'value': parseInt(smallClass.dictValue),
'label': smallClass.dictLabel
if (smallClass.remark) {
dishClass[parseInt(smallClass.remark - 1)].children.push({
value: parseInt(smallClass.dictValue),
label: smallClass.dictLabel
});
}
});
@ -520,6 +524,40 @@ const getters = {
// console.log(nutriData);
return nutriData;
},
verifyNotRecData: state =>
state.recipesData.reduce((arr, cur, dayIdx) => {
cur.dishes.forEach(dObj => {
dObj.igdList.forEach(iObj => {
(iObj.notRec || "").split(",").forEach(nRec => {
if (nRec) {
let tarObj = arr.find(obj => obj.name === nRec);
if (tarObj) {
tarObj.data.push({
igdId: iObj.id,
num: dayIdx,
dishesId: dObj.dishesId,
id: dObj.id
});
} else {
tarObj = {
name: nRec,
data: [
{
igdId: iObj.id,
num: dayIdx,
dishesId: dObj.dishesId,
id: dObj.id
}
]
};
arr.push(tarObj);
}
}
});
});
});
return arr;
}, []),
cusUnitDict: state =>
state.cusUnitOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel;
@ -544,8 +582,7 @@ const getters = {
state.dishSmallClassOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel;
return obj;
}, {}),
}, {})
};
export default {

@ -1,6 +1,6 @@
<template>
<div class="recipes_build_info_view_wrapper">
<div class="top" v-if="!!recipesData.length">
<div class="top" v-if="showChart">
<BarChart
v-if="analyseData.length > 1"
:data="analyseData"
@ -15,7 +15,10 @@
width="100%"
/>
</div>
<div class="content">
<div
class="content"
:style="`height: calc(100vh - ${showChart ? 192 : 32}px);`"
>
<TemplateInfoView v-if="!!temId" :data="templateInfo" />
<HealthyView :data="healthyData" v-else-if="healthyDataType === 0" dev />
<BodySignView :data="healthyData" v-else dev />
@ -24,11 +27,7 @@
</template>
<script>
import { createNamespacedHelpers } from "vuex";
const {
mapActions,
mapState,
mapGetters,
} = createNamespacedHelpers("recipes");
const { mapActions, mapState, mapGetters } = createNamespacedHelpers("recipes");
import BarChart from "./BarChart";
import PieChart from "./PieChart";
import TemplateInfoView from "./TemplateInfoView";
@ -54,6 +53,9 @@ export default {
? parseFloat(basicBMR.substring(0, basicBMR.indexOf("千卡")))
: 0;
},
showChart() {
return !!this.recipesData.length;
},
...mapState([
"recipesData",
"healthyData",
@ -72,7 +74,6 @@ export default {
.content {
overflow: auto;
height: calc(100% - 160px);
}
}
</style>

@ -2,7 +2,12 @@
<div class="recipes_header_com_wrapper">
<div class="header_btns" v-loading="loading">
<section style="display: flex; align-items: center">
<em class="el-icon-s-unfold collapse_btn" />
<em
:class="`${
leftShow ? 'el-icon-s-fold' : 'el-icon-s-unfold'
} collapse_btn`"
@click="toggleLeftShow"
/>
<div>食谱制作</div>
<el-button
size="mini"
@ -88,8 +93,6 @@ import TemplateDialog from "@/components/TemplateDialog";
export default {
name: "RecipesHeaderCom",
components: {
// BarChart,
// PieChart,
TemplateDialog,
},
data() {
@ -108,7 +111,7 @@ export default {
},
updated() {},
computed: {
...mapState(["recipesId", "reviewStatus", "fontSize"]),
...mapState(["recipesId", "reviewStatus", "fontSize", "leftShow"]),
},
watch: {},
methods: {
@ -155,7 +158,7 @@ export default {
});
},
...mapActions(["saveRecipes", "updateReviewStatus"]),
...mapMutations(["updateStateData", "updateFontSize"]),
...mapMutations(["updateStateData", "updateFontSize", "toggleLeftShow"]),
},
};
</script>
@ -168,7 +171,9 @@ export default {
padding-bottom: 8px;
.collapse_btn {
font-size: 18px;
padding: 4px;
cursor: pointer;
}
}

@ -0,0 +1,55 @@
<template>
<div class="verify_view_wrapper">
<div>忌口</div>
<div class="content">
<span
class="item"
v-for="item in verifyNotRecData"
:key="item.name"
@click="handleOnClick(item.data)"
>{{ item.name }}</span
>
</div>
</div>
</template>
<script>
import { createNamespacedHelpers } from "vuex";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers("recipes");
export default {
name: "VerifyView",
data() {
return {};
},
computed: {
...mapGetters(["verifyNotRecData"]),
},
methods: {
handleOnClick(data) {
console.log({ data, verifyNotRecData: this.verifyNotRecData });
},
},
};
</script>
<style lang="scss" scoped>
.verify_view_wrapper {
.content {
margin-top: 8px;
.item {
font-size: 14px;
margin: 4px;
border-radius: 8px;
cursor: pointer;
display: inline-block;
color: #262626;
border: 1px solid #8c8c8c;
padding: 3px 8px;
word-break: normal;
&:hover {
color: #d96969;
border-color: #d96969;
}
}
}
}
</style>

@ -1,6 +1,13 @@
<template>
<div class="recipes_build_wrapper" v-title :data-title="name">
<div class="left"></div>
<div
:class="`left ${leftShow ? 'left_show' : ''}`"
:style="`width: ${leftShow ? 260 : 0}px`"
>
<div v-show="leftShow">
<VerifyView />
</div>
</div>
<div class="content" v-loading="recipesDataLoading">
<RecipesView
v-if="!!recipesData.length"
@ -25,6 +32,7 @@ const {
import RecipesView from "./RecipesView";
import RecommendView from "./RecommendView";
import InfoView from "./InfoView";
import VerifyView from "./VerifyView";
export default {
name: "BuildRecipies",
@ -53,10 +61,12 @@ export default {
RecipesView,
RecommendView,
InfoView,
VerifyView,
},
props: ["name", "planId"],
computed: {
...mapState([
"leftShow",
"healthyData",
"recipesData",
"recipesDataLoading",
@ -74,19 +84,27 @@ export default {
padding: 16px;
display: flex;
height: 100vh;
.left {
// transition: all 0.5s;
}
.left_show {
margin-right: 16px;
border-right: 1px solid #e6ebf5;
}
.content {
flex: 4;
flex: 1;
border-right: 1px solid #e6ebf5;
height: 100%;
overflow: hidden;
padding-right: 20px;
padding-right: 16px;
}
.right {
flex: 1;
width: 380px;
height: 100%;
padding-left: 20px;
padding-left: 16px;
}
}
</style>

@ -21,7 +21,7 @@
<div class="title_style">
<span>{{ plan.label }}</span>
<em
class="el-icon-shopping-cart-full icon_style"
class="el-icon-shopping-cart-full icon_style shopping_cart"
@click="(e) => handleOnShoppingPlanClick(e, plan)"
/>
</div>
@ -155,6 +155,16 @@ export default {
font-size: 16px;
padding: 4px 8px;
}
.shopping_cart {
display: flex;
align-items: center;
&::after {
margin-left: 2px;
content: "采购";
font-size: 12px;
}
}
}
}
}