This commit is contained in:
xiezhijun 2021-04-08 14:43:10 +08:00
commit 070f36dd7c
7 changed files with 70 additions and 14 deletions
stdiet-custom/src/main
java/com/stdiet/custom
resources/mapper/custom
stdiet-ui/src
store/modules
views/custom/recipesBuild
InfoView/ShortCutCom
RecipesView
RecipesCom
RecipesHeaderCom

@ -13,5 +13,7 @@ public class SysRecipes {
private Long planId;
private int reviewStatus;
private List<SysRecipesDaily> menus;
}

@ -53,7 +53,7 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
// 更新食谱计划
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
sysRecipesPlan.setId(sysRecipes.getPlanId());
sysRecipesPlan.setReviewStatus(3);// 设置制作中
sysRecipesPlan.setReviewStatus(sysRecipes.getReviewStatus());// 设置制作中
sysRecipesPlan.setRecipesId(sysRecipes.getId());
sysRecipesPlanMapper.updateSysRecipesPlan(sysRecipesPlan);
}

@ -480,7 +480,7 @@
<!-- 根据客户ID查询该客户下所有订单 -->
<select id="getAllOrderByCusId" parameterType="Long" resultMap="SysOrderResult">
select * from sys_order where del_flag = 0 and cus_id = #{cusId} order by order_id asc
select * from sys_order where del_flag = 0 and cus_id = #{cusId} order by order_time asc
</select>
</mapper>

@ -242,9 +242,9 @@ const actions = {
if (recipesDataResult.code === 200) {
const { endNum, startNum, recipesId } = state;
// 计算
let length = endNum - startNum;
const length = endNum - startNum;
recipesData = recipesDataResult.data.reduce((outArr, dayData, idx) => {
if (!recipesId || length >= idx) {
if (length >= idx) {
outArr.push({
id: dayData.id,
numDay: !recipesId ? startNum + idx : dayData.numDay,
@ -311,6 +311,7 @@ const actions = {
const { recipesData, cusId, planId } = state;
const params = {
cusId: payload.cusId !== undefined ? payload.cusId : cusId,
reviewStatus: payload.reviewStatus,
planId: payload.planId || planId,
menus: recipesData.map((menu, idx) => ({
numDay: menu.numDay,
@ -531,7 +532,8 @@ const actions = {
}).then(() => {
window.postMessage(
{
type: messageTypes.UPDATE_SHORTCUT
type: messageTypes.UPDATE_SHORTCUT,
setCurrent: true
},
"*"
);

@ -50,8 +50,13 @@
/>
<!-- 菜品预览 -->
<el-table border :data="scope.row.data.igdList" v-else size="mini">
<el-table-column align="center" label="食材" prop="name" />
<el-table-column align="center" label="分量估算">
<el-table-column
align="center"
label="食材"
prop="name"
width="100"
/>
<el-table-column align="center" label="分量估算" width="100">
<template slot-scope="scope">
<span>{{
`${cusWeightDict[scope.row.cusWeight]}${
@ -60,7 +65,12 @@
}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="重量(g)" prop="weight" />
<el-table-column
align="center"
label="重量(g)"
prop="weight"
width="100"
/>
</el-table>
<el-button type="text" size="mini" slot="reference">预览</el-button>
</el-popover>
@ -68,7 +78,11 @@
</el-table-column>
<el-table-column label="操作" :width="60" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleOnDelete(scope.row)">
<el-button
type="text"
size="mini"
@click="handleOnDelete(scope.row)"
>
删除
</el-button>
</template>
@ -129,18 +143,24 @@ export default {
messageListener(e) {
const { data } = e;
if (data.type === messageTypes.UPDATE_SHORTCUT) {
this.getList();
this.getList(data.setCurrent);
}
},
getList() {
getList(setCurrent) {
getShortCut().then((data) => {
this.dataList = data;
// console.log(this.dataList);
if (setCurrent) {
this.$refs.shortCutTable.setCurrentRow(data[0]);
}
});
},
handleOnDelete(data) {
removeShortCut(data.id).then((res) => {
this.getList();
if (this.curShortCutObj.id === data.id) {
this.setCurShortCutObj({});
}
});
},
handleOnCurrentChange(data) {

@ -39,7 +39,10 @@
@click="handleOnMenuPasteClick"
>快捷替换</el-button
>
<div v-else-if="curShortCutObj.type" style="margin-top: 8px">
<div
v-else-if="curShortCutObj && curShortCutObj.type"
style="margin-top: 8px"
>
<el-button
icon="el-icon-right"
size="mini"
@ -56,7 +59,8 @@
@click="handleOnResetCurrentDay"
slot="reference"
>
{{ `${numDay}` }}
<div class="cus_name_hide" :id="`cus_name_${num}`">{{ name }}</div>
<div>{{ `${numDay}` }}</div>
</div>
</el-popover>
</template>
@ -411,6 +415,13 @@ export default {
}
const mData = processMenuData(this.data.dishes);
// console.log(mData);
// mData.forEach((obj, idx) =>
// console.log({
// num: this.num,
// type: obj.type,
// idx: idx + 1,
// })
// );
return mData;
},
@ -478,7 +489,9 @@ export default {
},
shouldPasteShow(type) {
return (
this.curShortCutObj.type && this.curShortCutObj.type.includes(type)
this.curShortCutObj &&
this.curShortCutObj.type &&
this.curShortCutObj.type.includes(type)
);
},
cellClassName({ row, column, rowIndex, columnIndex }) {
@ -780,4 +793,8 @@ export default {
background: #d66969;
color: blue;
}
.cus_name_hide {
display: none;
}
</style>

@ -146,6 +146,7 @@ export default {
},
handleOnSave() {
this.saveRecipes({
reviewStatus: 3, //
callback: (query) => {
// console.log(query);
let path = "/recipes/build/" + query.name + "/" + query.planId;
@ -175,6 +176,7 @@ export default {
this.saveRecipes({
cusId: 0,
planId,
reviewStatus: 2, //
callback: () => {
this.$message.success(`另存为模板「${form.name}」成功`);
this.loading = false;
@ -227,6 +229,12 @@ export default {
this.downloading = false;
return;
}
Array.from({ length: this.recipesData.length }).forEach((_, idx) => {
const tmpElm = document.getElementById(`cus_name_${idx}`);
if (tmpElm) {
tmpElm.classList = [];
}
});
recipesDom.style.overflow = "visible";
html2canvans(recipesDom, {
scale: 1.5,
@ -243,6 +251,13 @@ export default {
centerContentDom.style.overflow = "auto";
recipesDom.style.overflow = "auto";
Array.from({ length: this.recipesData.length }).forEach((_, idx) => {
const tmpElm = document.getElementById(`cus_name_${idx}`);
if (tmpElm) {
tmpElm.classList = ["cus_name_hide"];
}
});
this.downloading = false;
this.$message.success("食谱导出成功");
});