From fa3698cf160cf696195f7ffec1b54991a910a7e9 Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Tue, 30 Mar 2021 16:44:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A3=9F=E8=B0=B1=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=8F=91=E9=80=81=E7=8A=B6=E6=80=81=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/custom/SysRecipesPlanMapper.xml | 4 +-- .../components/RecipesPlanDrawer/index.vue | 30 ++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml index 39de38c7b..f13e36f46 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml @@ -221,7 +221,7 @@ <!-- 根据cusId查询食谱计划--> <select id="selectPlanListByCusId" parameterType="Long" resultMap="SysRecipesPlanResult"> - select id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, review_status from sys_recipes_plan + <include refid="selectSysRecipesPlanVo"/> where cus_id=#{cusId} and del_flag = 0 order by id asc </select> @@ -241,7 +241,7 @@ <!-- 通过outId查询食谱计划简要--> <select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult"> - select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId} and del_flag = 0 and review_status = 2 + select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId} and del_flag = 0 and review_status = 2 and send_flag = 1 </select> <resultMap type="SysRecipesDaily" id="SysRecipesResult"> diff --git a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue index fd39f40f6..7fb52978e 100644 --- a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue +++ b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue @@ -75,6 +75,14 @@ {{ `${scope.row.startDate} 至 ${scope.row.endDate}` }} </template> </el-table-column> + <el-table-column label="发送" align="center"> + <template slot-scope="scope"> + <el-switch + v-model="!!scope.row.sendFlag" + @change="(val) => handleOnSendChange(val, scope.row)" + /> + </template> + </el-table-column> <el-table-column label="操作" align="center" width="160"> <template slot-scope="scope"> <el-button @@ -201,7 +209,7 @@ export default { window.location.origin.replace("manage", "sign") + "/recipes/detail/" + this.cusOutId; - // console.log(this.planList); + console.log(this.planList); this.planLoading = false; }); }, @@ -314,6 +322,26 @@ export default { // }); }); }, + handleOnSendChange(val, data) { + console.log({ val, data }); + const { id } = data; + if (data.reviewStatus === 2) { + updateRecipesPlan({ + id, + sendFlag: val ? 1 : 0, + }).then((res) => { + if (res.code === 200) { + this.$message.success(res.msg); + const tarPlan = this.planList.find((obj) => obj.id === id); + if (tarPlan) { + tarPlan.sendFlag = val ? 1 : 0; + } + } + }); + } else { + this.$message.error("未审核的食谱不能发送"); + } + }, }, }; </script>