From f2946fea5943e2fb3aa7d9e855333b87e0c1ffbf Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Tue, 6 Apr 2021 19:13:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8F=9C=E8=B0=B1?= =?UTF-8?q?=E6=88=AA=E5=8F=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/custom/SysOrderMapper.xml | 2 +- stdiet-ui/src/store/modules/recipes.js | 7 ++-- .../InfoView/ShortCutCom/index.vue | 32 +++++++++++++++---- .../RecipesView/RecipesCom/index.vue | 16 ++++++++-- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml index 6962cad0b..ca57a9eff 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml @@ -480,7 +480,7 @@ \ No newline at end of file diff --git a/stdiet-ui/src/store/modules/recipes.js b/stdiet-ui/src/store/modules/recipes.js index 9a5f10ae1..1d7c7f307 100644 --- a/stdiet-ui/src/store/modules/recipes.js +++ b/stdiet-ui/src/store/modules/recipes.js @@ -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, @@ -531,7 +531,8 @@ const actions = { }).then(() => { window.postMessage( { - type: messageTypes.UPDATE_SHORTCUT + type: messageTypes.UPDATE_SHORTCUT, + setCurrent: true }, "*" ); diff --git a/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue index 60485a3da..3693aa495 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue @@ -50,8 +50,13 @@ /> - - + + - + 预览 @@ -68,7 +78,11 @@ @@ -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) { diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue index 5a7fb7b82..615791faf 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue @@ -39,7 +39,10 @@ @click="handleOnMenuPasteClick" >快捷替换 -
+
+ // console.log({ + // num: this.num, + // type: obj.type, + // idx: idx + 1, + // }) + // ); return mData; }, @@ -478,7 +488,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 }) { From 73d716126c63c268b322f6040c1c11fe0f64e8aa Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Wed, 7 Apr 2021 16:57:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=90=8D=E5=AD=97&=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E8=87=AA=E5=8A=A8=E5=B7=B2=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/stdiet/custom/domain/SysRecipes.java | 2 ++ .../service/impl/SysRecipesServiceImpl.java | 2 +- stdiet-ui/src/store/modules/recipes.js | 1 + .../recipesBuild/RecipesView/RecipesCom/index.vue | 7 ++++++- .../RecipesView/RecipesHeaderCom/index.vue | 15 +++++++++++++++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipes.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipes.java index 40dc33b41..5da4c6f9d 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipes.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipes.java @@ -13,5 +13,7 @@ public class SysRecipes { private Long planId; + private int reviewStatus; + private List menus; } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesServiceImpl.java index 8186a3c73..5ee6ef763 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesServiceImpl.java @@ -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); } diff --git a/stdiet-ui/src/store/modules/recipes.js b/stdiet-ui/src/store/modules/recipes.js index 1d7c7f307..2724e3c44 100644 --- a/stdiet-ui/src/store/modules/recipes.js +++ b/stdiet-ui/src/store/modules/recipes.js @@ -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, diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue index 615791faf..0fd2adafa 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue @@ -59,7 +59,8 @@ @click="handleOnResetCurrentDay" slot="reference" > - {{ `第${numDay}天` }} +
{{ name }}
+
{{ `第${numDay}天` }}
@@ -792,4 +793,8 @@ export default { background: #d66969; color: blue; } + +.cus_name_hide { + display: none; +} diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesHeaderCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesHeaderCom/index.vue index 46d51c089..73df723d5 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesHeaderCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesHeaderCom/index.vue @@ -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("食谱导出成功"); });