食谱模板功能完成
This commit is contained in:
@ -1,68 +0,0 @@
|
|||||||
package com.stdiet.web.controller.custom;
|
|
||||||
|
|
||||||
import com.stdiet.common.core.controller.BaseController;
|
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
|
||||||
import com.stdiet.common.core.page.TableDataInfo;
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
|
||||||
import com.stdiet.custom.service.ISysRecipesPlanModelService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 食谱模板
|
|
||||||
*
|
|
||||||
* @author wonder
|
|
||||||
* @date 2021-02-27
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/recipes/model")
|
|
||||||
public class SysRecipesPlanModelController extends BaseController {
|
|
||||||
@Autowired
|
|
||||||
private ISysRecipesPlanModelService iSysRecipesPlanModelService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('recipes:recipesModel:list')")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(SysRecipesPlanModel sysRecipesPlanModel) {
|
|
||||||
startPage();
|
|
||||||
List<SysRecipesPlanModel> list = iSysRecipesPlanModelService.selectRecipesModelListByCondition(sysRecipesPlanModel);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('recipes:recipesModel:edit')")
|
|
||||||
@PostMapping("/add")
|
|
||||||
public AjaxResult add(SysRecipesPlanModel sysRecipesPlanModel) {
|
|
||||||
return toAjax(iSysRecipesPlanModelService.insertRecipsesModel(sysRecipesPlanModel));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新
|
|
||||||
*
|
|
||||||
* @param sysRecipesPlanModel
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:list')")
|
|
||||||
@PutMapping(value = "/update")
|
|
||||||
public AjaxResult update(SysRecipesPlanModel sysRecipesPlanModel) {
|
|
||||||
return toAjax(iSysRecipesPlanModelService.updateRecipesModel(sysRecipesPlanModel));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:query')")
|
|
||||||
@DeleteMapping(value = "/delete/{id}")
|
|
||||||
public AjaxResult delete(@PathVariable("id") Long id) {
|
|
||||||
return AjaxResult.success(iSysRecipesPlanModelService.removeRecipesModel(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,71 @@
|
|||||||
|
package com.stdiet.web.controller.custom;
|
||||||
|
|
||||||
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
|
import com.stdiet.common.core.page.TableDataInfo;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||||
|
import com.stdiet.custom.service.ISysRecipesTemplateService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食谱模板
|
||||||
|
*
|
||||||
|
* @author wonder
|
||||||
|
* @date 2021-02-27
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/recipes/template")
|
||||||
|
public class SysRecipesTemplateController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysRecipesTemplateService iSysRecipesTemplateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysRecipesTemplate sysRecipesTemplate) {
|
||||||
|
startPage();
|
||||||
|
List<SysRecipesTemplate> list = iSysRecipesTemplateService.selectRecipesTemplateListByCondition(sysRecipesTemplate);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:list')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult detail(@PathVariable Long id) {
|
||||||
|
return AjaxResult.success(iSysRecipesTemplateService.getRecipesTemplateById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:edit')")
|
||||||
|
@PostMapping("/add")
|
||||||
|
public AjaxResult add(@RequestBody SysRecipesTemplate sysRecipesTemplate) {
|
||||||
|
return toAjax(iSysRecipesTemplateService.insertRecipsesTemplate(sysRecipesTemplate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:list')")
|
||||||
|
@PutMapping(value = "/update")
|
||||||
|
public AjaxResult update(@RequestBody SysRecipesTemplate sysRecipesTemplate) {
|
||||||
|
return toAjax(iSysRecipesTemplateService.updateRecipesTemplate(sysRecipesTemplate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:query')")
|
||||||
|
@DeleteMapping(value = "/delete/{id}")
|
||||||
|
public AjaxResult delete(@PathVariable("id") Long id) {
|
||||||
|
return AjaxResult.success(iSysRecipesTemplateService.removeRecipesTemplate(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,23 +1,32 @@
|
|||||||
package com.stdiet.custom.domain;
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SysRecipesPlanModel {
|
public class SysRecipesTemplate {
|
||||||
Long id;
|
Long id;
|
||||||
|
|
||||||
|
String name;
|
||||||
|
|
||||||
Long nutritionistId;
|
Long nutritionistId;
|
||||||
|
|
||||||
|
String nutritionist;
|
||||||
|
|
||||||
Long nutriAssisId;
|
Long nutriAssisId;
|
||||||
|
|
||||||
|
String nutriAssis;
|
||||||
|
|
||||||
Long planId;
|
Long planId;
|
||||||
|
|
||||||
String remark;
|
String remark;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
Date updateTime;
|
Date updateTime;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
Date createTime;
|
Date createTime;
|
||||||
|
|
||||||
String updateBy;
|
String updateBy;
|
||||||
@ -25,4 +34,6 @@ public class SysRecipesPlanModel {
|
|||||||
String createBy;
|
String createBy;
|
||||||
|
|
||||||
Long recipesId;
|
Long recipesId;
|
||||||
|
|
||||||
|
Integer reviewStatus;
|
||||||
}
|
}
|
@ -1,24 +0,0 @@
|
|||||||
package com.stdiet.custom.mapper;
|
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 食谱计划Mapper接口
|
|
||||||
*
|
|
||||||
* @author wonder
|
|
||||||
* @date 2021-02-27
|
|
||||||
*/
|
|
||||||
public interface SysRecipesPlanModelMapper
|
|
||||||
{
|
|
||||||
List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel);
|
|
||||||
|
|
||||||
int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
|
||||||
|
|
||||||
int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
|
||||||
|
|
||||||
int removeRecipesModel(Long id);
|
|
||||||
}
|
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.stdiet.custom.mapper;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食谱计划Mapper接口
|
||||||
|
*
|
||||||
|
* @author wonder
|
||||||
|
* @date 2021-02-27
|
||||||
|
*/
|
||||||
|
public interface SysRecipesTemplateMapper {
|
||||||
|
List<SysRecipesTemplate> selectRecipesTemplateListByCondition(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
|
int insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
|
int updateRecipesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
|
int removeRecipesTemplate(Long id);
|
||||||
|
|
||||||
|
SysRecipesTemplate getRecipesTemplateById(Long id);
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
package com.stdiet.custom.service;
|
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 食谱计划Service接口
|
|
||||||
*
|
|
||||||
* @author wonder
|
|
||||||
* @date 2021-02-27
|
|
||||||
*/
|
|
||||||
public interface ISysRecipesPlanModelService
|
|
||||||
{
|
|
||||||
|
|
||||||
List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel);
|
|
||||||
|
|
||||||
int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
|
||||||
|
|
||||||
int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
|
||||||
|
|
||||||
int removeRecipesModel(Long id);
|
|
||||||
}
|
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.stdiet.custom.service;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食谱计划Service接口
|
||||||
|
*
|
||||||
|
* @author wonder
|
||||||
|
* @date 2021-02-27
|
||||||
|
*/
|
||||||
|
public interface ISysRecipesTemplateService {
|
||||||
|
|
||||||
|
List<SysRecipesTemplate> selectRecipesTemplateListByCondition(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
|
int insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
|
int updateRecipesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
|
int removeRecipesTemplate(Long id);
|
||||||
|
|
||||||
|
SysRecipesTemplate getRecipesTemplateById(Long id);
|
||||||
|
}
|
@ -1,67 +0,0 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
|
||||||
|
|
||||||
import com.stdiet.common.utils.DateUtils;
|
|
||||||
import com.stdiet.common.utils.SecurityUtils;
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
|
||||||
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
|
||||||
import com.stdiet.custom.mapper.SysRecipesPlanModelMapper;
|
|
||||||
import com.stdiet.custom.service.ISysRecipesPlanModelService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 食谱计划Service业务层处理
|
|
||||||
*
|
|
||||||
* @author wonder
|
|
||||||
* @date 2021-02-27
|
|
||||||
*/
|
|
||||||
@Service("sysRecipesPlanModelService")
|
|
||||||
@Transactional
|
|
||||||
public class SysRecipesPlanModelServiceImpl implements ISysRecipesPlanModelService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
SysRecipesPlanModelMapper sysRecipesPlanModelMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
SysRecipesPlanMapper sysRecipesPlanMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel) {
|
|
||||||
return sysRecipesPlanModelMapper.selectRecipesModelListByCondition(sysRecipesPlanModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel) {
|
|
||||||
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
|
||||||
sysRecipesPlan.setStartNumDay(1);
|
|
||||||
sysRecipesPlan.setEndNumDay(7);
|
|
||||||
sysRecipesPlan.setType(1);
|
|
||||||
int rows = sysRecipesPlanMapper.insertSysRecipesPlan(sysRecipesPlan);
|
|
||||||
if (rows > 0) {
|
|
||||||
sysRecipesPlanModel.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
sysRecipesPlanModel.setCreateTime(DateUtils.getNowDate());
|
|
||||||
sysRecipesPlanModel.setPlanId(sysRecipesPlan.getId());
|
|
||||||
return sysRecipesPlanModelMapper.insertRecipsesModel(sysRecipesPlanModel);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel) {
|
|
||||||
sysRecipesPlanModel.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
sysRecipesPlanModel.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return sysRecipesPlanModelMapper.updateRecipesModel(sysRecipesPlanModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int removeRecipesModel(Long id) {
|
|
||||||
return sysRecipesPlanModelMapper.removeRecipesModel(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
|
import com.stdiet.common.utils.DateUtils;
|
||||||
|
import com.stdiet.common.utils.SecurityUtils;
|
||||||
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||||
|
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||||
|
import com.stdiet.custom.mapper.SysRecipesTemplateMapper;
|
||||||
|
import com.stdiet.custom.service.ISysRecipesTemplateService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食谱计划Service业务层处理
|
||||||
|
*
|
||||||
|
* @author wonder
|
||||||
|
* @date 2021-02-27
|
||||||
|
*/
|
||||||
|
@Service("sysRecipesPlanModelService")
|
||||||
|
@Transactional
|
||||||
|
public class SysRecipesTemplateServiceImpl implements ISysRecipesTemplateService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysRecipesTemplateMapper sysRecipesTemplateMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysRecipesPlanMapper sysRecipesPlanMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysRecipesTemplate> selectRecipesTemplateListByCondition(SysRecipesTemplate sysRecipesTemplate) {
|
||||||
|
return sysRecipesTemplateMapper.selectRecipesTemplateListByCondition(sysRecipesTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate) {
|
||||||
|
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||||
|
sysRecipesPlan.setStartNumDay(1);
|
||||||
|
sysRecipesPlan.setEndNumDay(7);
|
||||||
|
sysRecipesPlan.setType(1);
|
||||||
|
sysRecipesPlanMapper.insertSysRecipesPlan(sysRecipesPlan);
|
||||||
|
if (!StringUtils.isNull(sysRecipesPlan.getId())) {
|
||||||
|
sysRecipesTemplate.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
sysRecipesTemplate.setCreateTime(DateUtils.getNowDate());
|
||||||
|
sysRecipesTemplate.setPlanId(sysRecipesPlan.getId());
|
||||||
|
return sysRecipesTemplateMapper.insertRecipsesTemplate(sysRecipesTemplate);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateRecipesTemplate(SysRecipesTemplate sysRecipesTemplate) {
|
||||||
|
sysRecipesTemplate.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
sysRecipesTemplate.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return sysRecipesTemplateMapper.updateRecipesTemplate(sysRecipesTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int removeRecipesTemplate(Long id) {
|
||||||
|
return sysRecipesTemplateMapper.removeRecipesTemplate(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysRecipesTemplate getRecipesTemplateById(Long id) {
|
||||||
|
return sysRecipesTemplateMapper.getRecipesTemplateById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -86,6 +86,7 @@
|
|||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="delFlag != null">del_flag,</if>
|
<if test="delFlag != null">del_flag,</if>
|
||||||
<if test="reviewStatus != null">review_status,</if>
|
<if test="reviewStatus != null">review_status,</if>
|
||||||
|
<if test="type != null">type,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="orderId != null">#{orderId},</if>
|
<if test="orderId != null">#{orderId},</if>
|
||||||
@ -104,6 +105,7 @@
|
|||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="delFlag != null">#{delFlag},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||||
|
<if test="type != null">#{type},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -163,7 +165,7 @@
|
|||||||
<!-- 食谱计划、订单表联查 -->
|
<!-- 食谱计划、订单表联查 -->
|
||||||
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||||
SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone,
|
SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone,
|
||||||
su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,
|
su_nutritionist.nick_name AS nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,
|
||||||
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer, srp.review_status
|
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer, srp.review_status
|
||||||
FROM sys_recipes_plan srp
|
FROM sys_recipes_plan srp
|
||||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||||
@ -215,7 +217,7 @@
|
|||||||
<!-- 根据cusId查询食谱计划-->
|
<!-- 根据cusId查询食谱计划-->
|
||||||
<select id="selectPlanListByCusId" parameterType="Long" resultMap="SysRecipesPlanResult">
|
<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
|
select id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, review_status from sys_recipes_plan
|
||||||
where cus_id=#{cusId} order by create_time desc
|
where cus_id=#{cusId} order by id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
|
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.stdiet.custom.mapper.SysRecipesPlanModelMapper">
|
|
||||||
|
|
||||||
<resultMap type="SysRecipesPlanModel" id="SysRecipesModelResult">
|
|
||||||
<result property="id" column="id"/>
|
|
||||||
<result property="planId" column="plan_id"/>
|
|
||||||
<result property="nutritionistId" column="nutritionist_id"/>
|
|
||||||
<result property="nutriAssisId" column="nutri_assis_id"/>
|
|
||||||
<result property="remark" column="remark"/>
|
|
||||||
<result property="createTime" column="create_time"/>
|
|
||||||
<result property="createBy" column="create_by"/>
|
|
||||||
<result property="updateTime" column="update_time"/>
|
|
||||||
<result property="updateBy" column="update_by"/>
|
|
||||||
<result property="recipesId" column="recipes_id"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<select id="selectRecipesModelListByCondition" parameterType="SysRecipesPlanModel" resultMap="SysRecipesModelResult">
|
|
||||||
select srpm.id, srpm.nutritionist_id, srpm.nutri_assis_id, srpm.remark, srpm.update_time,
|
|
||||||
srpm.create_time, srpm.update_by, srpm.create_by, srpm.plan_id, srp.recipes_id, srp.review_status
|
|
||||||
from sys_recipes_plan_model srpm
|
|
||||||
left join sys_recipes_plan srp on srp.id = srpm.plan_id
|
|
||||||
where del_flag = 0
|
|
||||||
<if test="nutriAssisId != null ">and nutri_assis_id = #{nutriAssisId}</if>
|
|
||||||
<if test="nutritionistId != null ">and nutritionist_id = #{nutritionistId}</if>
|
|
||||||
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
|
|
||||||
order by srpm.create_time desc
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertRecipsesModel" parameterType="SysRecipesPlanModel" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into sys_recipes_plan_model
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="nutriAssisId != null">nutri_assis_id,</if>
|
|
||||||
<if test="nutritionistId != null">nutritionist_id,</if>
|
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="createBy != null">create_by,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
<if test="updateBy != null">update_by,</if>
|
|
||||||
<if test="remark != null">remark,</if>
|
|
||||||
<if test="reviewStatus != null">review_status,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="nutriAssisId != null">#{nutriAssisId},</if>
|
|
||||||
<if test="nutritionistId != null">#{nutritionistId},</if>
|
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="createBy != null">#{createBy},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
|
||||||
<if test="remark != null">#{remark},</if>
|
|
||||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateRecipesModel" parameterType="SysRecipesPlanModel">
|
|
||||||
update sys_recipes_plan_model
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="nutriAssisId != null">nutri_assis_id = #{nutriAssisId},</if>
|
|
||||||
<if test="nutritionistId != null">nutritionist_id = #{nutritionistId},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
|
||||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="removeRecipesModel" parameterType="Long">
|
|
||||||
update sys_recipes_plan_model set del_flag=1 where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
</mapper>
|
|
@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.stdiet.custom.mapper.SysRecipesTemplateMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysRecipesTemplate" id="SysRecipesTemplateResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="planId" column="plan_id"/>
|
||||||
|
<result property="nutritionistId" column="nutritionist_id"/>
|
||||||
|
<result property="nutriAssisId" column="nutri_assis_id"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="recipesId" column="recipes_id"/>
|
||||||
|
<result property="reviewStatus" column="review_status"/>
|
||||||
|
|
||||||
|
<result property="nutritionist" column="nutritionist"/>
|
||||||
|
<result property="nutriAssis" column="nutritionist_assis"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectRecipesTemplateListByCondition" parameterType="SysRecipesTemplate" resultMap="SysRecipesTemplateResult">
|
||||||
|
select srt.id, srt.name, srt.nutritionist_id, srt.nutri_assis_id, srt.remark, srt.update_time,
|
||||||
|
srt.create_time, srt.update_by, srt.create_by, srt.plan_id, srp.recipes_id, srp.review_status,
|
||||||
|
su_nutritionist.nick_name as nutritionist, su_nutritionist_assis.nick_name as nutritionist_assis
|
||||||
|
from sys_recipes_template srt
|
||||||
|
left join sys_recipes_plan srp on srp.id = srt.plan_id
|
||||||
|
left join sys_user su_nutritionist on su_nutritionist.user_id = srt.nutritionist_id and su_nutritionist.del_flag = 0
|
||||||
|
left join sys_user su_nutritionist_assis on su_nutritionist_assis.user_id = srt.nutri_assis_id and su_nutritionist_assis.del_flag = 0
|
||||||
|
where srt.del_flag = 0
|
||||||
|
<if test="name != null and name != ''">and srt.name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="nutriAssisId != null ">and srt.nutri_assis_id = #{nutriAssisId}</if>
|
||||||
|
<if test="nutritionistId != null ">and srt.nutritionist_id = #{nutritionistId}</if>
|
||||||
|
<if test="reviewStatus != null ">and srp.review_status = #{reviewStatus}</if>
|
||||||
|
order by srt.id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRecipesTemplateById" parameterType="Long" resultType="SysRecipesTemplate">
|
||||||
|
select srt.id, srt.name, srt.nutritionist_id as nutritionistId, srt.nutri_assis_id as nutriAssisId, srt.remark, srt.update_time as updateTime,
|
||||||
|
srt.create_time as createTime, srt.update_by as updateBy, srt.create_by as createBy, srt.plan_id as planId,
|
||||||
|
su_nutritionist.nick_name as nutritionist, su_nutritionist_assis.nick_name as nutriAssis
|
||||||
|
from sys_recipes_template srt
|
||||||
|
left join sys_user su_nutritionist on su_nutritionist.user_id = srt.nutritionist_id and su_nutritionist.del_flag = 0
|
||||||
|
left join sys_user su_nutritionist_assis on su_nutritionist_assis.user_id = srt.nutri_assis_id and su_nutritionist_assis.del_flag = 0
|
||||||
|
where srt.id = #{id} and srt.del_flag = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertRecipsesTemplate" parameterType="SysRecipesTemplate" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_recipes_template
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="name != null">name,</if>
|
||||||
|
<if test="planId != null">plan_id,</if>
|
||||||
|
<if test="nutriAssisId != null">nutri_assis_id,</if>
|
||||||
|
<if test="nutritionistId != null">nutritionist_id,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="name != null">#{name},</if>
|
||||||
|
<if test="planId != null">#{planId},</if>
|
||||||
|
<if test="nutriAssisId != null">#{nutriAssisId},</if>
|
||||||
|
<if test="nutritionistId != null">#{nutritionistId},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateRecipesTemplate" parameterType="SysRecipesTemplate">
|
||||||
|
update sys_recipes_template
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="name != null">name = #{name},</if>
|
||||||
|
<if test="nutriAssisId != null">nutri_assis_id = #{nutriAssisId},</if>
|
||||||
|
<if test="nutritionistId != null">nutritionist_id = #{nutritionistId},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="removeRecipesTemplate" parameterType="Long">
|
||||||
|
update sys_recipes_template set del_flag=1 where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
@ -1,33 +0,0 @@
|
|||||||
import request from "@/utils/request";
|
|
||||||
|
|
||||||
export function listRecipesModel(query) {
|
|
||||||
return request({
|
|
||||||
url: "/recipes/model/list",
|
|
||||||
method: "get",
|
|
||||||
params: query
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function addRecipesModel(data){
|
|
||||||
return request({
|
|
||||||
url: "/recipes/model/add",
|
|
||||||
method: "post",
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function updateRecipesModel(data) {
|
|
||||||
return request({
|
|
||||||
url: "/recipes/model/update",
|
|
||||||
method: "put",
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function deleteRecipesModel(id) {
|
|
||||||
return request({
|
|
||||||
url: "/recipes/model/delete/" + id,
|
|
||||||
method: "get"
|
|
||||||
});
|
|
||||||
}
|
|
39
stdiet-ui/src/api/custom/recipesTemplate.js
Normal file
39
stdiet-ui/src/api/custom/recipesTemplate.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
export function listRecipesTemplate(query) {
|
||||||
|
return request({
|
||||||
|
url: "/recipes/template/list",
|
||||||
|
method: "get",
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRecipesTemplateDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: "/recipes/template/" + id,
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addRecipesTemplate(data) {
|
||||||
|
return request({
|
||||||
|
url: "/recipes/template/add",
|
||||||
|
method: "post",
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateRecipesTemplate(data) {
|
||||||
|
return request({
|
||||||
|
url: "/recipes/template/update",
|
||||||
|
method: "put",
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteRecipesTemplate(id) {
|
||||||
|
return request({
|
||||||
|
url: "/recipes/template/delete/" + id,
|
||||||
|
method: "delete"
|
||||||
|
});
|
||||||
|
}
|
@ -7,12 +7,14 @@ import {
|
|||||||
deleteDishesApi,
|
deleteDishesApi,
|
||||||
addRecipesApi
|
addRecipesApi
|
||||||
} from "@/api/custom/recipes";
|
} from "@/api/custom/recipes";
|
||||||
|
import { getRecipesTemplateDetail } from "@/api/custom/recipesTemplate";
|
||||||
import { getRecipesPlan, updateRecipesPlan } from "@/api/custom/recipesPlan";
|
import { getRecipesPlan, updateRecipesPlan } from "@/api/custom/recipesPlan";
|
||||||
import { getDicts } from "@/api/system/dict/data";
|
import { getDicts } from "@/api/system/dict/data";
|
||||||
|
|
||||||
const oriState = {
|
const oriState = {
|
||||||
cusId: undefined,
|
cusId: undefined,
|
||||||
planId: undefined,
|
planId: undefined,
|
||||||
|
temId: undefined,
|
||||||
recipesId: undefined,
|
recipesId: undefined,
|
||||||
healthyData: {},
|
healthyData: {},
|
||||||
healthDataLoading: false,
|
healthDataLoading: false,
|
||||||
@ -25,7 +27,8 @@ const oriState = {
|
|||||||
currentDay: -1,
|
currentDay: -1,
|
||||||
startNum: 0,
|
startNum: 0,
|
||||||
endNum: 0,
|
endNum: 0,
|
||||||
reviewStatus: 0
|
reviewStatus: 0,
|
||||||
|
templateInfo: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
@ -87,6 +90,7 @@ const actions = {
|
|||||||
cusId,
|
cusId,
|
||||||
recipesId,
|
recipesId,
|
||||||
reviewStatus,
|
reviewStatus,
|
||||||
|
temId: payload.temId,
|
||||||
planId: payload.planId,
|
planId: payload.planId,
|
||||||
startNum: startNumDay,
|
startNum: startNumDay,
|
||||||
endNum: endNumDay
|
endNum: endNumDay
|
||||||
@ -108,12 +112,25 @@ const actions = {
|
|||||||
dispatch("getHealthyData", { cusId }).catch(err => rej(err));
|
dispatch("getHealthyData", { cusId }).catch(err => rej(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 模板信息
|
||||||
|
if (payload.temId) {
|
||||||
|
dispatch("getRecipesTemplate", payload).catch(err => rej(err));
|
||||||
|
}
|
||||||
|
|
||||||
// 食谱数据
|
// 食谱数据
|
||||||
if (recipesId) {
|
if (recipesId) {
|
||||||
dispatch("getRecipesInfo", { recipesId }).catch(err => rej(err));
|
dispatch("getRecipesInfo", { recipesId }).catch(err => rej(err));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
async getRecipesTemplate({ commit, state }, { temId }) {
|
||||||
|
const response = await getRecipesTemplateDetail(temId);
|
||||||
|
if (response.code === 200) {
|
||||||
|
commit("updateStateData", {
|
||||||
|
templateInfo: response.data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
async updateReviewStatus({ commit, state }, payload) {
|
async updateReviewStatus({ commit, state }, payload) {
|
||||||
const response = await updateRecipesPlan({
|
const response = await updateRecipesPlan({
|
||||||
id: state.planId,
|
id: state.planId,
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
:style="`height: ${collapse ? 30 : 200}px`"
|
:style="`height: ${collapse ? 30 : 200}px`"
|
||||||
>
|
>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
<el-button size="mini" v-if="!recipesId" @click="handleOnBack"
|
||||||
|
>返回</el-button
|
||||||
|
>
|
||||||
<el-popover
|
<el-popover
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
@ -101,6 +104,9 @@ export default {
|
|||||||
hanldeOnReveiwChange(reviewStatus) {
|
hanldeOnReveiwChange(reviewStatus) {
|
||||||
this.updateReviewStatus({ reviewStatus });
|
this.updateReviewStatus({ reviewStatus });
|
||||||
},
|
},
|
||||||
|
handleOnBack() {
|
||||||
|
this.updateReviewStatus({ recipesData: [] });
|
||||||
|
},
|
||||||
...mapActions(["saveRecipes", "updateReviewStatus"]),
|
...mapActions(["saveRecipes", "updateReviewStatus"]),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<template>
|
||||||
|
<div>推荐列表</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "TemplateView",
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,97 @@
|
|||||||
|
<template>
|
||||||
|
<div class="template_view_wrapper">
|
||||||
|
<div class="header">
|
||||||
|
<el-button size="mini" @click="handleOnBackClick">返回</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<h2>选择模板</h2>
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="dataList"
|
||||||
|
highlight-current-row
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
>
|
||||||
|
<el-table-column label="模板名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="营养师" align="center" prop="nutritionist" />
|
||||||
|
<el-table-column label="营养师助理" align="center" prop="nutriAssis" />
|
||||||
|
<el-table-column label="备注" prop="remark" align="center" />
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { listRecipesTemplate } from "@/api/custom/recipesTemplate";
|
||||||
|
export default {
|
||||||
|
name: "TemplateView",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
dataList: [],
|
||||||
|
total: 0,
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
reviewStatus: 2,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: ["view"],
|
||||||
|
methods: {
|
||||||
|
handleOnBackClick() {
|
||||||
|
this.$emit("update:view", 0);
|
||||||
|
this.queryParams = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
reviewStatus: 2,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listRecipesTemplate(this.queryParams).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.dataList = res.rows;
|
||||||
|
this.total = res.total;
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCurrentChange(data) {
|
||||||
|
this.$emit("onSelect", data);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$emit("update:view", 0);
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
view: function (val, oldVal) {
|
||||||
|
if (val === 1) {
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.template_view_wrapper {
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
height: 32px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
height: calc(100% - 32px);
|
||||||
|
padding-top: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="recommend_view_wrapper">
|
||||||
|
<div class="selector_view" v-if="curView === 0">
|
||||||
|
<div class="card_content" @click="handleOnClick(1)">
|
||||||
|
<em class="el-icon-brush" />
|
||||||
|
<span>模板</span>
|
||||||
|
</div>
|
||||||
|
<div class="card_content" @click="handleOnClick(2)" v-if="false">
|
||||||
|
<em class="el-icon-star-off" />
|
||||||
|
<span>推荐</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TemplateView :view.sync="curView" @onSelect="handleOnSelect" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { createNamespacedHelpers } from "vuex";
|
||||||
|
import TemplateView from "./TemplateView";
|
||||||
|
import RecommendView from "./RecommendView";
|
||||||
|
const {
|
||||||
|
mapActions,
|
||||||
|
mapState,
|
||||||
|
mapMutations,
|
||||||
|
mapGetters,
|
||||||
|
} = createNamespacedHelpers("recipes");
|
||||||
|
export default {
|
||||||
|
name: "RecommondView",
|
||||||
|
components: {
|
||||||
|
RecommendView,
|
||||||
|
TemplateView,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
curView: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleOnClick(type) {
|
||||||
|
this.curView = type;
|
||||||
|
},
|
||||||
|
handleOnSelect(data) {
|
||||||
|
const { recipesId } = data;
|
||||||
|
this.getRecipesInfo({ recipesId });
|
||||||
|
},
|
||||||
|
...mapActions(["getRecipesInfo"]),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.recommend_view_wrapper {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
.selector_view {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.card_content {
|
||||||
|
cursor: pointer;
|
||||||
|
margin: 6px;
|
||||||
|
padding: 100px 80px;
|
||||||
|
border: 3px solid #e6ebf5;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
& > em {
|
||||||
|
font-size: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > span {
|
||||||
|
margin-top: 12px;
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #409eff;
|
||||||
|
color: #1890ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
<template>
|
|
||||||
<el-button @click="handleOnClick">推荐</el-button>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import { createNamespacedHelpers } from "vuex";
|
|
||||||
const {
|
|
||||||
mapActions,
|
|
||||||
mapState,
|
|
||||||
mapMutations,
|
|
||||||
mapGetters,
|
|
||||||
} = createNamespacedHelpers("recipes");
|
|
||||||
export default {
|
|
||||||
name: "RecommondView",
|
|
||||||
methods: {
|
|
||||||
handleOnClick() {
|
|
||||||
this.getRecipesInfo({ recipesId: 73 });
|
|
||||||
},
|
|
||||||
...mapActions(["getRecipesInfo"]),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
@ -0,0 +1,89 @@
|
|||||||
|
<template>
|
||||||
|
<div class="template_info_wrapper">
|
||||||
|
<h2>{{ data.name }}</h2>
|
||||||
|
<TextInfo title="营养师" :value="data.nutritionist" />
|
||||||
|
<TextInfo
|
||||||
|
title="营养师助理"
|
||||||
|
:value="data.nutriAssis"
|
||||||
|
style="margin-top: 24px"
|
||||||
|
/>
|
||||||
|
<div class="remark_info">
|
||||||
|
<span class="info_title">备注:</span>
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
:rows="8"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
v-model="data.remark"
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 12px; text-align: right">
|
||||||
|
<el-button v-if="change" type="primary" size="mini" @click="handleSubmit"
|
||||||
|
>提交</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import TextInfo from "@/components/TextInfo";
|
||||||
|
import { updateRecipesTemplate } from "@/api/custom/recipesTemplate";
|
||||||
|
export default {
|
||||||
|
name: "TemplateInfoView",
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
id: "",
|
||||||
|
name: "",
|
||||||
|
nutritionist: "",
|
||||||
|
nutriAssis: "",
|
||||||
|
remark: "",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
TextInfo,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
oriRemark: "",
|
||||||
|
change: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"data.remark": function (val, oldVal) {
|
||||||
|
if (!oldVal && val) {
|
||||||
|
this.oriRemark = val;
|
||||||
|
}
|
||||||
|
this.change = this.oriRemark !== val;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSubmit() {
|
||||||
|
const { remark, id } = this.data;
|
||||||
|
updateRecipesTemplate({ id, remark }).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message.success("修改成功");
|
||||||
|
this.change = false;
|
||||||
|
this.oriRemark = remark;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.template_info_wrapper {
|
||||||
|
.remark_info {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-top: 24px;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.info_title {
|
||||||
|
color: #8c8c8c;
|
||||||
|
flex: 0 0 48px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -7,10 +7,11 @@
|
|||||||
:name="healthyData.name"
|
:name="healthyData.name"
|
||||||
:analyseData="analyseData"
|
:analyseData="analyseData"
|
||||||
/>
|
/>
|
||||||
<RecommondView v-else />
|
<RecommendView v-else />
|
||||||
</div>
|
</div>
|
||||||
<div class="right" v-loading="healthDataLoading">
|
<div class="right" v-loading="healthDataLoading">
|
||||||
<HealthyView :data="healthyData" v-if="healthyDataType === 0" />
|
<TemplateInfoView v-if="!!temId" :data="templateInfo" />
|
||||||
|
<HealthyView :data="healthyData" v-else-if="healthyDataType === 0" />
|
||||||
<BodySignView :data="healthyData" v-else />
|
<BodySignView :data="healthyData" v-else />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -27,16 +28,21 @@ const {
|
|||||||
import HealthyView from "@/components/HealthyView";
|
import HealthyView from "@/components/HealthyView";
|
||||||
import BodySignView from "@/components/BodySignView";
|
import BodySignView from "@/components/BodySignView";
|
||||||
import RecipesView from "./RecipesView/index";
|
import RecipesView from "./RecipesView/index";
|
||||||
import RecommondView from "./RecommondView";
|
import RecommendView from "./RecommendView";
|
||||||
|
import TemplateInfoView from "./TemplateInfoView";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "BuildRecipies",
|
name: "BuildRecipies",
|
||||||
data() {
|
data() {
|
||||||
return {};
|
const { temId } = this.$route.query;
|
||||||
|
return {
|
||||||
|
temId,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init({
|
this.init({
|
||||||
planId: this.planId,
|
planId: this.planId,
|
||||||
|
temId: this.temId,
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
this.$message.error(err.message);
|
this.$message.error(err.message);
|
||||||
});
|
});
|
||||||
@ -49,13 +55,15 @@ export default {
|
|||||||
HealthyView,
|
HealthyView,
|
||||||
BodySignView,
|
BodySignView,
|
||||||
RecipesView,
|
RecipesView,
|
||||||
RecommondView,
|
RecommendView,
|
||||||
|
TemplateInfoView,
|
||||||
},
|
},
|
||||||
props: ["name", "planId"],
|
props: ["name", "planId"],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
"healthyData",
|
"healthyData",
|
||||||
"healthyDataType",
|
"healthyDataType",
|
||||||
|
"templateInfo",
|
||||||
"recipesData",
|
"recipesData",
|
||||||
"recipesDataLoading",
|
"recipesDataLoading",
|
||||||
"healthDataLoading",
|
"healthDataLoading",
|
||||||
|
@ -1,331 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-form
|
|
||||||
:model="queryParams"
|
|
||||||
ref="queryForm"
|
|
||||||
:inline="true"
|
|
||||||
v-show="showSearch"
|
|
||||||
>
|
|
||||||
<el-form-item label="营养师" prop="nutritionistId">
|
|
||||||
<el-select
|
|
||||||
v-model="queryParams.nutritionistId"
|
|
||||||
placeholder="请选择营养师"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in nutritionistIdOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictLabel"
|
|
||||||
:value="dict.dictValue"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="营养师助理" prop="nutritionistAssisId">
|
|
||||||
<el-select
|
|
||||||
v-model="queryParams.nutritionistAssisId"
|
|
||||||
placeholder="请选择营养师助理"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in nutriAssisIdOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictLabel"
|
|
||||||
:value="dict.dictValue"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="审核状态" prop="reviewStatus">
|
|
||||||
<el-select
|
|
||||||
v-model="queryParams.reviewStatus"
|
|
||||||
placeholder="请选审核状态"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in reviewStatusOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictLabel"
|
|
||||||
:value="dict.dictValue"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button
|
|
||||||
type="cyan"
|
|
||||||
icon="el-icon-search"
|
|
||||||
size="mini"
|
|
||||||
@click="handleQuery"
|
|
||||||
>搜索</el-button
|
|
||||||
>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
||||||
>重置</el-button
|
|
||||||
>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
|
||||||
<right-toolbar
|
|
||||||
:showSearch.sync="showSearch"
|
|
||||||
@queryTable="getList"
|
|
||||||
></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="recipesPlanList">
|
|
||||||
<el-table-column label="审核状态" align="center" width="100">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag
|
|
||||||
:type="
|
|
||||||
!scope.row.reviewStatus
|
|
||||||
? 'info'
|
|
||||||
: scope.row.reviewStatus === 1
|
|
||||||
? 'danger'
|
|
||||||
: 'success'
|
|
||||||
"
|
|
||||||
>{{
|
|
||||||
`${
|
|
||||||
!scope.row.reviewStatus
|
|
||||||
? "未制作"
|
|
||||||
: scope.row.reviewStatus == 1
|
|
||||||
? "未审核"
|
|
||||||
: "已审核"
|
|
||||||
}`
|
|
||||||
}}</el-tag
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="营养师"
|
|
||||||
align="center"
|
|
||||||
prop="nutritionist"
|
|
||||||
width="100"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="营养师助理"
|
|
||||||
align="center"
|
|
||||||
width="100"
|
|
||||||
prop="nutritionistAssis"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="创建时间"
|
|
||||||
align="center"
|
|
||||||
width="100"
|
|
||||||
prop="create_time"
|
|
||||||
/>
|
|
||||||
<el-table-column label="备注" prop="remark" align="center" />
|
|
||||||
<el-table-column
|
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
class-name="small-padding fixed-width"
|
|
||||||
width="300"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
v-hasPermi="['recipes:recipesPlan:edit']"
|
|
||||||
:icon="`${
|
|
||||||
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
|
||||||
}`"
|
|
||||||
@click="handleBuild(scope.row)"
|
|
||||||
>{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}</el-button
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total > 0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {
|
|
||||||
listRecipesModel,
|
|
||||||
addRecipesModel,
|
|
||||||
updateRecipesModel,
|
|
||||||
deleteRecipesModel,
|
|
||||||
} from "@/api/custom/recipesPlanModel";
|
|
||||||
import dayjs from "dayjs";
|
|
||||||
import store from "@/store";
|
|
||||||
import { mapState } from "vuex";
|
|
||||||
|
|
||||||
const userId = store.getters && store.getters.userId;
|
|
||||||
export default {
|
|
||||||
name: "recipesPlan",
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 遮罩层
|
|
||||||
loading: true,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 食谱计划表格数据
|
|
||||||
recipesPlanList: [],
|
|
||||||
orderDialog: undefined,
|
|
||||||
reviewStatusOptions: [
|
|
||||||
{ dictValue: 0, dictLabel: "未制作" },
|
|
||||||
{ dictValue: 1, dictLabel: "未审核" },
|
|
||||||
{ dictValue: 2, dictLabel: "已审核" },
|
|
||||||
],
|
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
nutritionistId: null,
|
|
||||||
nutritionistAssisId: null,
|
|
||||||
reviewStatus: null,
|
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {},
|
|
||||||
//食谱开始时间范围
|
|
||||||
planStartDateScope: [nextDate, nextDate],
|
|
||||||
//订单对于所有计划安排数据
|
|
||||||
allRecipesPlanList: [],
|
|
||||||
//订单弹窗状态
|
|
||||||
allRecipesPlanOpen: false,
|
|
||||||
allRecipesPlanTitle: "",
|
|
||||||
//订单弹窗中查询参数
|
|
||||||
allRecipesPlanQueryParam: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
orderId: null,
|
|
||||||
sendFlag: 0,
|
|
||||||
},
|
|
||||||
//订单弹窗中列表数据的总条数
|
|
||||||
allRecipesPlanTotal: 0,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
// "order-dialog": OrderDetail,
|
|
||||||
// body_sign_dialog: BodySignDetail,
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState({
|
|
||||||
//营养师
|
|
||||||
nutritionistIdOptions: (state) =>
|
|
||||||
state.global.nutritionistIdOptions.slice(1),
|
|
||||||
//营养师助理
|
|
||||||
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
nutritionistIdOptions: function (val, oldVal) {
|
|
||||||
if (val.length && !oldVal.length) {
|
|
||||||
const tarObj = val.find((opt) => opt.dictValue == userId);
|
|
||||||
if (tarObj) {
|
|
||||||
this.queryParams.nutritionistId = userId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nutriAssisIdOptions: function (val, oldVal) {
|
|
||||||
if (val.length && !oldVal.length) {
|
|
||||||
const tarObj = val.find((opt) => opt.dictValue == userId);
|
|
||||||
if (tarObj) {
|
|
||||||
this.queryParams.nutritionistAssisId = userId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
/** 查询食谱计划列表 */
|
|
||||||
getList() {
|
|
||||||
this.loading = true;
|
|
||||||
if (
|
|
||||||
this.planStartDateScope != null &&
|
|
||||||
this.planStartDateScope.length > 0
|
|
||||||
) {
|
|
||||||
this.queryParams.startDate = dayjs(this.planStartDateScope[0]).format(
|
|
||||||
"YYYY-MM-DD"
|
|
||||||
);
|
|
||||||
this.queryParams.endDate = dayjs(this.planStartDateScope[1]).format(
|
|
||||||
"YYYY-MM-DD"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.queryParams.startDate = null;
|
|
||||||
this.queryParams.endDate = null;
|
|
||||||
}
|
|
||||||
listRecipesPlan(this.queryParams).then((response) => {
|
|
||||||
this.recipesPlanList = response.rows;
|
|
||||||
this.recipesPlanList.forEach(function (item, index) {
|
|
||||||
item.scopeDate =
|
|
||||||
dayjs(item.startDate).format("YYYY-MM-DD") +
|
|
||||||
" 至 " +
|
|
||||||
dayjs(item.endDate).format("YYYY-MM-DD");
|
|
||||||
item.scopeDay = `第${item.startNumDay} 至 ${item.endNumDay}天`;
|
|
||||||
});
|
|
||||||
this.total = response.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: null,
|
|
||||||
orderId: null,
|
|
||||||
startDate: null,
|
|
||||||
endDate: null,
|
|
||||||
recipesId: null,
|
|
||||||
sendFlag: null,
|
|
||||||
sendTime: null,
|
|
||||||
createTime: null,
|
|
||||||
createBy: null,
|
|
||||||
updateTime: null,
|
|
||||||
updateBy: null,
|
|
||||||
delFlag: null,
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.planStartDateScope = [nextDate, nextDate];
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
const queryParams = this.queryParams;
|
|
||||||
this.$confirm("是否确认导出所有食谱计划数据项?", "警告", {
|
|
||||||
confirmButtonText: "确定",
|
|
||||||
cancelButtonText: "取消",
|
|
||||||
type: "warning",
|
|
||||||
})
|
|
||||||
.then(function () {
|
|
||||||
return exportRecipesPlan(queryParams);
|
|
||||||
})
|
|
||||||
.then((response) => {
|
|
||||||
this.download(response.msg);
|
|
||||||
})
|
|
||||||
.catch(function () {});
|
|
||||||
},
|
|
||||||
handleBuild(data) {
|
|
||||||
// console.log(data);
|
|
||||||
const { id, customer } = data;
|
|
||||||
window.open("/recipes/build/" + customer + "/" + id, "_blank");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
458
stdiet-ui/src/views/custom/recipesTemplate/index.vue
Normal file
458
stdiet-ui/src/views/custom/recipesTemplate/index.vue
Normal file
@ -0,0 +1,458 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
>
|
||||||
|
<el-form-item label="模板名称" prop="name">
|
||||||
|
<el-input v-model="queryParams.name" placeholder="请输入模板名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="营养师" prop="nutritionistId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.nutritionistId"
|
||||||
|
placeholder="请选择营养师"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutritionistIdOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="营养师助理" prop="nutriAssisId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.nutriAssisId"
|
||||||
|
placeholder="请选择营养师助理"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutriAssisIdOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="审核状态" prop="reviewStatus">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.reviewStatus"
|
||||||
|
placeholder="请选审核状态"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in reviewStatusOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="cyan"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['custom:ingredient:add']"
|
||||||
|
>新增
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="recipesTemplateList">
|
||||||
|
<el-table-column label="审核状态" align="center" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag
|
||||||
|
:type="
|
||||||
|
!scope.row.reviewStatus
|
||||||
|
? 'info'
|
||||||
|
: scope.row.reviewStatus === 1
|
||||||
|
? 'danger'
|
||||||
|
: 'success'
|
||||||
|
"
|
||||||
|
>{{
|
||||||
|
`${
|
||||||
|
!scope.row.reviewStatus
|
||||||
|
? "未制作"
|
||||||
|
: scope.row.reviewStatus == 1
|
||||||
|
? "未审核"
|
||||||
|
: "已审核"
|
||||||
|
}`
|
||||||
|
}}</el-tag
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="模板名称"
|
||||||
|
align="center"
|
||||||
|
prop="name"
|
||||||
|
width="160"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="营养师"
|
||||||
|
align="center"
|
||||||
|
prop="nutritionistId"
|
||||||
|
width="100"
|
||||||
|
:formatter="nutritionistIdFormat"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="营养师助理"
|
||||||
|
align="center"
|
||||||
|
width="100"
|
||||||
|
prop="nutriAssisId"
|
||||||
|
:formatter="nutriAssisIdFormat"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
width="180"
|
||||||
|
prop="createTime"
|
||||||
|
/>
|
||||||
|
<el-table-column label="备注" prop="remark" align="center" />
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
width="300"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleOnTemplateEdit(scope.row)"
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
v-hasPermi="['recipes:recipesTemplate:edit']"
|
||||||
|
:icon="`${
|
||||||
|
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||||
|
}`"
|
||||||
|
@click="handleOnRecipesEdit(scope.row)"
|
||||||
|
>{{ `${scope.row.recipesId ? "编辑" : "制作"}食谱` }}</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleOnDelete(scope.row)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改食材对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="520px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="模板名称" prop="name" label-width="100px">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入模板名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="营养师" prop="nutritionistId" label-width="100px">
|
||||||
|
<el-select v-model="form.nutritionistId" placeholder="请选择营养师">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutritionistIdOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="营养师助理"
|
||||||
|
prop="nutriAssisId"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-select v-model="form.nutriAssisId" placeholder="请选择营养师助理">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutriAssisIdOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark" label-width="100px">
|
||||||
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
:rows="4"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listRecipesTemplate,
|
||||||
|
addRecipesTemplate,
|
||||||
|
updateRecipesTemplate,
|
||||||
|
deleteRecipesTemplate,
|
||||||
|
} from "@/api/custom/recipesTemplate";
|
||||||
|
import store from "@/store";
|
||||||
|
import { mapState } from "vuex";
|
||||||
|
|
||||||
|
const userId = store.getters && store.getters.userId;
|
||||||
|
export default {
|
||||||
|
name: "recipesTemplate",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 食谱计划表格数据
|
||||||
|
recipesTemplateList: [],
|
||||||
|
orderDialog: undefined,
|
||||||
|
reviewStatusOptions: [
|
||||||
|
{ dictValue: 0, dictLabel: "未制作" },
|
||||||
|
{ dictValue: 1, dictLabel: "未审核" },
|
||||||
|
{ dictValue: 2, dictLabel: "已审核" },
|
||||||
|
],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
nutritionistId: null,
|
||||||
|
nutriAssisId: null,
|
||||||
|
reviewStatus: null,
|
||||||
|
},
|
||||||
|
open: false,
|
||||||
|
title: "",
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
name: [{ required: true, message: "请输入模板名称", trigger: "blur" }],
|
||||||
|
nutritionistId: [
|
||||||
|
{ required: true, message: "请选择营养师", trigger: "blur" },
|
||||||
|
],
|
||||||
|
nutriAssisId: [
|
||||||
|
{ required: true, message: "请选择营养师助理", trigger: "blur" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
//订单对于所有计划安排数据
|
||||||
|
allRecipesPlanList: [],
|
||||||
|
//订单弹窗状态
|
||||||
|
allRecipesPlanOpen: false,
|
||||||
|
allRecipesPlanTitle: "",
|
||||||
|
//订单弹窗中查询参数
|
||||||
|
allRecipesPlanQueryParam: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
orderId: null,
|
||||||
|
sendFlag: 0,
|
||||||
|
},
|
||||||
|
//订单弹窗中列表数据的总条数
|
||||||
|
allRecipesPlanTotal: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
// "order-dialog": OrderDetail,
|
||||||
|
// body_sign_dialog: BodySignDetail,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
//营养师
|
||||||
|
nutritionistIdOptions: (state) =>
|
||||||
|
state.global.nutritionistIdOptions.slice(1),
|
||||||
|
//营养师助理
|
||||||
|
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// nutritionistIdOptions: function (val, oldVal) {
|
||||||
|
// if (val.length && !oldVal.length) {
|
||||||
|
// const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||||
|
// if (tarObj) {
|
||||||
|
// this.queryParams.nutritionistId = userId;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// nutriAssisIdOptions: function (val, oldVal) {
|
||||||
|
// if (val.length && !oldVal.length) {
|
||||||
|
// const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||||
|
// if (tarObj) {
|
||||||
|
// this.queryParams.nutriAssisId = userId;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询食谱计划列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listRecipesTemplate(this.queryParams).then((response) => {
|
||||||
|
this.recipesTemplateList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加模板";
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
name: null,
|
||||||
|
remark: null,
|
||||||
|
nutritionistId: null,
|
||||||
|
nutriAssisId: null,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
const queryParams = this.queryParams;
|
||||||
|
this.$confirm("是否确认导出所有食谱计划数据项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return exportRecipesPlan(queryParams);
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.download(response.msg);
|
||||||
|
})
|
||||||
|
.catch(function () {});
|
||||||
|
},
|
||||||
|
handleOnDelete(data) {
|
||||||
|
this.$confirm(`是否确认删除「${data.name}」?`, "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
deleteRecipesTemplate(data.id).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
handleOnTemplateEdit(data) {
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改模板";
|
||||||
|
this.reset();
|
||||||
|
this.form = data;
|
||||||
|
},
|
||||||
|
handleOnRecipesEdit(data) {
|
||||||
|
// console.log(data);
|
||||||
|
const { planId, name, id } = data;
|
||||||
|
window.open(
|
||||||
|
"/recipes/build/" + name + "/" + planId + "?temId=" + id,
|
||||||
|
"_blank"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
// 主营养师字典翻译
|
||||||
|
nutritionistIdFormat(row, column) {
|
||||||
|
return this.selectDictLabel(
|
||||||
|
this.nutritionistIdOptions,
|
||||||
|
row.nutritionistId
|
||||||
|
);
|
||||||
|
},
|
||||||
|
// 助理营养师字典翻译
|
||||||
|
nutriAssisIdFormat(row, column) {
|
||||||
|
return this.selectDictLabel(this.nutriAssisIdOptions, row.nutriAssisId);
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateRecipesTemplate(this.form).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addRecipesTemplate(this.form).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user