外食计算器
This commit is contained in:
parent
3c42485f52
commit
20371f9469
@ -9,14 +9,11 @@ import com.stdiet.custom.domain.SysCustomer;
|
|||||||
import com.stdiet.custom.domain.SysCustomerHealthy;
|
import com.stdiet.custom.domain.SysCustomerHealthy;
|
||||||
import com.stdiet.custom.domain.SysPhysicalSigns;
|
import com.stdiet.custom.domain.SysPhysicalSigns;
|
||||||
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
||||||
import com.stdiet.custom.service.ISysCustomerHealthyService;
|
import com.stdiet.custom.dto.request.FoodHeatCalculatorRequest;
|
||||||
import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
|
import com.stdiet.custom.service.*;
|
||||||
import com.stdiet.custom.service.ISysCustomerService;
|
|
||||||
import com.stdiet.custom.service.ISysPhysicalSignsService;
|
|
||||||
import com.stdiet.system.service.ISysDictTypeService;
|
import com.stdiet.system.service.ISysDictTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -47,6 +44,9 @@ public class InvestigateController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysCustomerService sysCustomerService;
|
private ISysCustomerService sysCustomerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysFoodHeatStatisticsService sysFoodHeatStatisticsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 建立客户信息档案
|
* 建立客户信息档案
|
||||||
*/
|
*/
|
||||||
@ -107,4 +107,13 @@ public class InvestigateController extends BaseController {
|
|||||||
return sysCustomerHealthyService.insertSysCustomerHealthy(sysCustomerHealthy);
|
return sysCustomerHealthyService.insertSysCustomerHealthy(sysCustomerHealthy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增客户外食计算统计
|
||||||
|
*/
|
||||||
|
@PostMapping("/addFoodHeatStatistics")
|
||||||
|
public AjaxResult addFoodHeatStatistics(@RequestBody FoodHeatCalculatorRequest foodHeatCalculatorRequest)
|
||||||
|
{
|
||||||
|
return toAjax(sysFoodHeatStatisticsService.addMuchFoodHeat(foodHeatCalculatorRequest));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ public class SysCustomerController extends BaseController {
|
|||||||
for (SysCustomer sysCus : list) {
|
for (SysCustomer sysCus : list) {
|
||||||
if (StringUtils.isNotEmpty(sysCus.getPhone())) {
|
if (StringUtils.isNotEmpty(sysCus.getPhone())) {
|
||||||
sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone()));
|
sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone()));
|
||||||
|
sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId()+"", null) : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,17 +144,17 @@ public class SysCustomerController extends BaseController {
|
|||||||
//查询健康评估信息
|
//查询健康评估信息
|
||||||
SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id);
|
SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id);
|
||||||
if(sysCustomerHealthy != null){
|
if(sysCustomerHealthy != null){
|
||||||
if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) {
|
/* if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) {
|
||||||
sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone()));
|
sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone()));
|
||||||
}
|
}*/
|
||||||
result.put(key, sysCustomerHealthy);
|
result.put(key, sysCustomerHealthy);
|
||||||
}else{
|
}else{
|
||||||
//查询体征信息
|
//查询体征信息
|
||||||
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id);
|
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id);
|
||||||
if(sysCustomerPhysicalSigns != null){
|
if(sysCustomerPhysicalSigns != null){
|
||||||
if (StringUtils.isNotEmpty(sysCustomerPhysicalSigns.getPhone())) {
|
/* if (StringUtils.isNotEmpty(sysCustomerPhysicalSigns.getPhone())) {
|
||||||
sysCustomerPhysicalSigns.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerPhysicalSigns.getPhone()));
|
sysCustomerPhysicalSigns.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerPhysicalSigns.getPhone()));
|
||||||
}
|
}*/
|
||||||
result.put("type", 1);
|
result.put("type", 1);
|
||||||
}
|
}
|
||||||
result.put(key, sysCustomerPhysicalSigns);
|
result.put(key, sysCustomerPhysicalSigns);
|
||||||
|
@ -0,0 +1,103 @@
|
|||||||
|
package com.stdiet.web.controller.custom;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.stdiet.common.annotation.Log;
|
||||||
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
|
import com.stdiet.common.enums.BusinessType;
|
||||||
|
import com.stdiet.custom.domain.SysFoodHeatStatistics;
|
||||||
|
import com.stdiet.custom.service.ISysFoodHeatStatisticsService;
|
||||||
|
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||||
|
import com.stdiet.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外食热量统计Controller
|
||||||
|
*
|
||||||
|
* @author xzj
|
||||||
|
* @date 2021-02-19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/custom/foodHeatStatistics")
|
||||||
|
public class SysFoodHeatStatisticsController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysFoodHeatStatisticsService sysFoodHeatStatisticsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询外食热量统计列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysFoodHeatStatistics sysFoodHeatStatistics)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysFoodHeatStatistics> list = sysFoodHeatStatisticsService.selectSysFoodHeatStatisticsList(sysFoodHeatStatistics);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出外食热量统计列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:export')")
|
||||||
|
@Log(title = "外食热量统计", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public AjaxResult export(SysFoodHeatStatistics sysFoodHeatStatistics)
|
||||||
|
{
|
||||||
|
List<SysFoodHeatStatistics> list = sysFoodHeatStatisticsService.selectSysFoodHeatStatisticsList(sysFoodHeatStatistics);
|
||||||
|
ExcelUtil<SysFoodHeatStatistics> util = new ExcelUtil<SysFoodHeatStatistics>(SysFoodHeatStatistics.class);
|
||||||
|
return util.exportExcel(list, "foodHeatStatistics");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取外食热量统计详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(sysFoodHeatStatisticsService.selectSysFoodHeatStatisticsById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增外食热量统计
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:add')")
|
||||||
|
@Log(title = "外食热量统计", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody SysFoodHeatStatistics sysFoodHeatStatistics)
|
||||||
|
{
|
||||||
|
return toAjax(sysFoodHeatStatisticsService.insertSysFoodHeatStatistics(sysFoodHeatStatistics));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改外食热量统计
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:edit')")
|
||||||
|
@Log(title = "外食热量统计", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody SysFoodHeatStatistics sysFoodHeatStatistics)
|
||||||
|
{
|
||||||
|
return toAjax(sysFoodHeatStatisticsService.updateSysFoodHeatStatistics(sysFoodHeatStatistics));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除外食热量统计
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:remove')")
|
||||||
|
@Log(title = "外食热量统计", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(sysFoodHeatStatisticsService.deleteSysFoodHeatStatisticsByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package com.stdiet.custom.domain;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.stdiet.common.annotation.Excel;
|
import com.stdiet.common.annotation.Excel;
|
||||||
@ -14,6 +15,7 @@ import com.stdiet.common.core.domain.BaseEntity;
|
|||||||
* @author xzj
|
* @author xzj
|
||||||
* @date 2020-12-31
|
* @date 2020-12-31
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class SysCustomer extends BaseEntity
|
public class SysCustomer extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -21,6 +23,9 @@ public class SysCustomer extends BaseEntity
|
|||||||
/** $column.columnComment */
|
/** $column.columnComment */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
//加密ID
|
||||||
|
private String encId;
|
||||||
|
|
||||||
/** 名字 */
|
/** 名字 */
|
||||||
@Excel(name = "名字")
|
@Excel(name = "名字")
|
||||||
private String name;
|
private String name;
|
||||||
@ -90,188 +95,4 @@ public class SysCustomer extends BaseEntity
|
|||||||
/** 体征数据,非持久化字段 */
|
/** 体征数据,非持久化字段 */
|
||||||
private SysCustomerPhysicalSigns sign;
|
private SysCustomerPhysicalSigns sign;
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setPhone(String phone)
|
|
||||||
{
|
|
||||||
this.phone = phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhone()
|
|
||||||
{
|
|
||||||
return phone;
|
|
||||||
}
|
|
||||||
public void setEmail(String email)
|
|
||||||
{
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail()
|
|
||||||
{
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
public void setAddress(String address)
|
|
||||||
{
|
|
||||||
this.address = address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAddress()
|
|
||||||
{
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
public void setPayDate(Date payDate)
|
|
||||||
{
|
|
||||||
this.payDate = payDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getPayDate()
|
|
||||||
{
|
|
||||||
return payDate;
|
|
||||||
}
|
|
||||||
public void setStartDate(Date startDate)
|
|
||||||
{
|
|
||||||
this.startDate = startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getStartDate()
|
|
||||||
{
|
|
||||||
return startDate;
|
|
||||||
}
|
|
||||||
public void setPurchaseNum(Long purchaseNum)
|
|
||||||
{
|
|
||||||
this.purchaseNum = purchaseNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getPurchaseNum()
|
|
||||||
{
|
|
||||||
return purchaseNum;
|
|
||||||
}
|
|
||||||
public void setPayTotal(BigDecimal payTotal)
|
|
||||||
{
|
|
||||||
this.payTotal = payTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPayTotal()
|
|
||||||
{
|
|
||||||
return payTotal;
|
|
||||||
}
|
|
||||||
public void setMainDietitian(Long mainDietitian)
|
|
||||||
{
|
|
||||||
this.mainDietitian = mainDietitian;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMainDietitian()
|
|
||||||
{
|
|
||||||
return mainDietitian;
|
|
||||||
}
|
|
||||||
public void setAssistantDietitian(Long assistantDietitian)
|
|
||||||
{
|
|
||||||
this.assistantDietitian = assistantDietitian;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getAssistantDietitian()
|
|
||||||
{
|
|
||||||
return assistantDietitian;
|
|
||||||
}
|
|
||||||
public void setAfterDietitian(Long afterDietitian)
|
|
||||||
{
|
|
||||||
this.afterDietitian = afterDietitian;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getAfterDietitian()
|
|
||||||
{
|
|
||||||
return afterDietitian;
|
|
||||||
}
|
|
||||||
public void setSalesman(Long salesman)
|
|
||||||
{
|
|
||||||
this.salesman = salesman;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSalesman()
|
|
||||||
{
|
|
||||||
return salesman;
|
|
||||||
}
|
|
||||||
public void setChargePerson(Long chargePerson)
|
|
||||||
{
|
|
||||||
this.chargePerson = chargePerson;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getChargePerson()
|
|
||||||
{
|
|
||||||
return chargePerson;
|
|
||||||
}
|
|
||||||
public void setFollowStatus(Long followStatus)
|
|
||||||
{
|
|
||||||
this.followStatus = followStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getFollowStatus()
|
|
||||||
{
|
|
||||||
return followStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SysCustomerPhysicalSigns getSign() {
|
|
||||||
return sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSign(SysCustomerPhysicalSigns sign) {
|
|
||||||
this.sign = sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDelFlag() {
|
|
||||||
return delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDelFlag(Integer delFlag) {
|
|
||||||
this.delFlag = delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getFansTime() {
|
|
||||||
return fansTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFansTime(Date fansTime) {
|
|
||||||
this.fansTime = fansTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("phone", getPhone())
|
|
||||||
.append("email", getEmail())
|
|
||||||
.append("address", getAddress())
|
|
||||||
.append("payDate", getPayDate())
|
|
||||||
.append("startDate", getStartDate())
|
|
||||||
.append("purchaseNum", getPurchaseNum())
|
|
||||||
.append("payTotal", getPayTotal())
|
|
||||||
.append("mainDietitian", getMainDietitian())
|
|
||||||
.append("assistantDietitian", getAssistantDietitian())
|
|
||||||
.append("afterDietitian", getAfterDietitian())
|
|
||||||
.append("salesman", getSalesman())
|
|
||||||
.append("chargePerson", getChargePerson())
|
|
||||||
.append("followStatus", getFollowStatus())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.stdiet.common.annotation.Excel;
|
||||||
|
import com.stdiet.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外食热量统计对象 sys_food_heat_statistics
|
||||||
|
*
|
||||||
|
* @author xzj
|
||||||
|
* @date 2021-02-19
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysFoodHeatStatistics extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 客户ID */
|
||||||
|
@Excel(name = "客户ID")
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/** 食材 */
|
||||||
|
@Excel(name = "食材")
|
||||||
|
private String ingredient;
|
||||||
|
|
||||||
|
/** 通俗单位ID */
|
||||||
|
@Excel(name = "通俗单位ID")
|
||||||
|
private Long unit;
|
||||||
|
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/** 通俗单位数量 */
|
||||||
|
@Excel(name = "通俗单位数量")
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
/** 具体质量,单位:克 */
|
||||||
|
@Excel(name = "具体质量,单位:克")
|
||||||
|
private Integer quantity;
|
||||||
|
|
||||||
|
/** 食用日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "食用日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date edibleDate;
|
||||||
|
|
||||||
|
/** 类型,0早 1中 2晚 */
|
||||||
|
@Excel(name = "类型,0早 1中 2晚")
|
||||||
|
private Integer edibleType;
|
||||||
|
|
||||||
|
/** 热量数值 */
|
||||||
|
@Excel(name = "热量数值")
|
||||||
|
private Integer heatValue;
|
||||||
|
|
||||||
|
/** 热量缺口 */
|
||||||
|
@Excel(name = "热量缺口")
|
||||||
|
private Integer heatGap;
|
||||||
|
|
||||||
|
/** 删除标识 0未删除 1已删除 */
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
}
|
@ -29,6 +29,8 @@ public class SysWxFanStatistics extends BaseEntity
|
|||||||
@Excel(name = "进粉账号")
|
@Excel(name = "进粉账号")
|
||||||
private String account;
|
private String account;
|
||||||
|
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
//销售组别
|
//销售组别
|
||||||
private String saleGroup;
|
private String saleGroup;
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.stdiet.custom.dto.request;
|
||||||
|
|
||||||
|
import com.stdiet.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FoodHeatCalculatorRequest extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
//客户ID加密串
|
||||||
|
private String customerEncId;
|
||||||
|
|
||||||
|
//食材数据对应JSON数组字符串
|
||||||
|
private String ingredientArray;
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.stdiet.custom.mapper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import com.stdiet.custom.domain.SysFoodHeatStatistics;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外食热量统计Mapper接口
|
||||||
|
*
|
||||||
|
* @author xzj
|
||||||
|
* @date 2021-02-19
|
||||||
|
*/
|
||||||
|
public interface SysFoodHeatStatisticsMapper {
|
||||||
|
/**
|
||||||
|
* 查询外食热量统计
|
||||||
|
*
|
||||||
|
* @param id 外食热量统计ID
|
||||||
|
* @return 外食热量统计
|
||||||
|
*/
|
||||||
|
public SysFoodHeatStatistics selectSysFoodHeatStatisticsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询外食热量统计列表
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 外食热量统计集合
|
||||||
|
*/
|
||||||
|
public List<SysFoodHeatStatistics> selectSysFoodHeatStatisticsList(SysFoodHeatStatistics sysFoodHeatStatistics);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增外食热量统计
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysFoodHeatStatistics(SysFoodHeatStatistics sysFoodHeatStatistics);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改外食热量统计
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysFoodHeatStatistics(SysFoodHeatStatistics sysFoodHeatStatistics);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除外食热量统计
|
||||||
|
*
|
||||||
|
* @param id 外食热量统计ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysFoodHeatStatisticsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除外食热量统计
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysFoodHeatStatisticsByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量添加
|
||||||
|
* @param sysFoodHeatStatisticsList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int insertFoodHeatBatch(List<HashMap> sysFoodHeatStatisticsList);
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.stdiet.custom.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.stdiet.custom.domain.SysFoodHeatStatistics;
|
||||||
|
import com.stdiet.custom.dto.request.FoodHeatCalculatorRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外食热量统计Service接口
|
||||||
|
*
|
||||||
|
* @author xzj
|
||||||
|
* @date 2021-02-19
|
||||||
|
*/
|
||||||
|
public interface ISysFoodHeatStatisticsService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询外食热量统计
|
||||||
|
*
|
||||||
|
* @param id 外食热量统计ID
|
||||||
|
* @return 外食热量统计
|
||||||
|
*/
|
||||||
|
public SysFoodHeatStatistics selectSysFoodHeatStatisticsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询外食热量统计列表
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 外食热量统计集合
|
||||||
|
*/
|
||||||
|
public List<SysFoodHeatStatistics> selectSysFoodHeatStatisticsList(SysFoodHeatStatistics sysFoodHeatStatistics);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增外食热量统计
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysFoodHeatStatistics(SysFoodHeatStatistics sysFoodHeatStatistics);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改外食热量统计
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysFoodHeatStatistics(SysFoodHeatStatistics sysFoodHeatStatistics);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除外食热量统计
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的外食热量统计ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysFoodHeatStatisticsByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除外食热量统计信息
|
||||||
|
*
|
||||||
|
* @param id 外食热量统计ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysFoodHeatStatisticsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户自己添加外食计算数据,批量添加
|
||||||
|
* @param foodHeatCalculatorRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int addMuchFoodHeat(FoodHeatCalculatorRequest foodHeatCalculatorRequest);
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.stdiet.common.utils.DateUtils;
|
||||||
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.common.utils.sign.AesUtils;
|
||||||
|
import com.stdiet.custom.dto.request.FoodHeatCalculatorRequest;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.stdiet.custom.mapper.SysFoodHeatStatisticsMapper;
|
||||||
|
import com.stdiet.custom.domain.SysFoodHeatStatistics;
|
||||||
|
import com.stdiet.custom.service.ISysFoodHeatStatisticsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外食热量统计Service业务层处理
|
||||||
|
*
|
||||||
|
* @author xzj
|
||||||
|
* @date 2021-02-19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysFoodHeatStatisticsServiceImpl implements ISysFoodHeatStatisticsService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private SysFoodHeatStatisticsMapper sysFoodHeatStatisticsMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询外食热量统计
|
||||||
|
*
|
||||||
|
* @param id 外食热量统计ID
|
||||||
|
* @return 外食热量统计
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysFoodHeatStatistics selectSysFoodHeatStatisticsById(Long id)
|
||||||
|
{
|
||||||
|
return sysFoodHeatStatisticsMapper.selectSysFoodHeatStatisticsById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询外食热量统计列表
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 外食热量统计
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysFoodHeatStatistics> selectSysFoodHeatStatisticsList(SysFoodHeatStatistics sysFoodHeatStatistics)
|
||||||
|
{
|
||||||
|
return sysFoodHeatStatisticsMapper.selectSysFoodHeatStatisticsList(sysFoodHeatStatistics);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增外食热量统计
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSysFoodHeatStatistics(SysFoodHeatStatistics sysFoodHeatStatistics)
|
||||||
|
{
|
||||||
|
sysFoodHeatStatistics.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return sysFoodHeatStatisticsMapper.insertSysFoodHeatStatistics(sysFoodHeatStatistics);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改外食热量统计
|
||||||
|
*
|
||||||
|
* @param sysFoodHeatStatistics 外食热量统计
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSysFoodHeatStatistics(SysFoodHeatStatistics sysFoodHeatStatistics)
|
||||||
|
{
|
||||||
|
sysFoodHeatStatistics.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return sysFoodHeatStatisticsMapper.updateSysFoodHeatStatistics(sysFoodHeatStatistics);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除外食热量统计
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的外食热量统计ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysFoodHeatStatisticsByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return sysFoodHeatStatisticsMapper.deleteSysFoodHeatStatisticsByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除外食热量统计信息
|
||||||
|
*
|
||||||
|
* @param id 外食热量统计ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysFoodHeatStatisticsById(Long id)
|
||||||
|
{
|
||||||
|
return sysFoodHeatStatisticsMapper.deleteSysFoodHeatStatisticsById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户自己添加外食计算数据,批量添加
|
||||||
|
* @param foodHeatCalculatorRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int addMuchFoodHeat(FoodHeatCalculatorRequest foodHeatCalculatorRequest){
|
||||||
|
//客户ID解密
|
||||||
|
String customerId = StringUtils.isNotEmpty(foodHeatCalculatorRequest.getCustomerEncId()) ? AesUtils.decrypt(foodHeatCalculatorRequest.getCustomerEncId(), null) : "";
|
||||||
|
if(StringUtils.isEmpty(customerId)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
List<SysFoodHeatStatistics> list = new ArrayList<>();
|
||||||
|
if(StringUtils.isNotEmpty(foodHeatCalculatorRequest.getIngredientArray())){
|
||||||
|
List<HashMap> foodHeatList = JSON.parseArray(foodHeatCalculatorRequest.getIngredientArray(), HashMap.class);
|
||||||
|
for(HashMap map : foodHeatList){
|
||||||
|
map.put("customerId", customerId);
|
||||||
|
}
|
||||||
|
return sysFoodHeatStatisticsMapper.insertFoodHeatBatch(foodHeatList);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,119 @@
|
|||||||
|
<?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.SysFoodHeatStatisticsMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysFoodHeatStatistics" id="SysFoodHeatStatisticsResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="customerId" column="customer_id" />
|
||||||
|
<result property="ingredient" column="ingredient" />
|
||||||
|
<result property="unit" column="unit" />
|
||||||
|
<result property="number" column="number" />
|
||||||
|
<result property="quantity" column="quantity" />
|
||||||
|
<result property="edibleDate" column="edible_date" />
|
||||||
|
<result property="edibleType" column="edible_type" />
|
||||||
|
<result property="heatValue" column="heat_value" />
|
||||||
|
<result property="heatGap" column="heat_gap" />
|
||||||
|
<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="delFlag" column="del_flag" />
|
||||||
|
|
||||||
|
<result property="unitName" column="unitName"></result>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysFoodHeatStatisticsVo">
|
||||||
|
select id, customer_id, ingredient, unit, number, quantity, edible_date, edible_type, heat_value, heat_gap, create_time, create_by, update_time, update_by, del_flag from sys_food_heat_statistics
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysFoodHeatStatisticsList" parameterType="SysFoodHeatStatistics" resultMap="SysFoodHeatStatisticsResult">
|
||||||
|
select sfhs.id, sfhs.customer_id, sfhs.ingredient, sfhs.unit, sfhs.number, sfhs.quantity, sfhs.edible_date, sfhs.edible_type, sfhs.heat_value, sfhs.heat_gap,cusUnit.dict_label as unitName
|
||||||
|
from sys_food_heat_statistics as sfhs
|
||||||
|
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_cus_unit') AS cusUnit ON cusUnit.dict_value = sfhs.unit
|
||||||
|
where sfhs.del_flag = 0
|
||||||
|
<if test="customerId != null "> and sfhs.customer_id = #{customerId}</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysFoodHeatStatisticsById" parameterType="Long" resultMap="SysFoodHeatStatisticsResult">
|
||||||
|
<include refid="selectSysFoodHeatStatisticsVo"/>
|
||||||
|
where id = #{id} and del_flag = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysFoodHeatStatistics" parameterType="SysFoodHeatStatistics" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_food_heat_statistics
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="customerId != null">customer_id,</if>
|
||||||
|
<if test="ingredient != null">ingredient,</if>
|
||||||
|
<if test="unit != null">unit,</if>
|
||||||
|
<if test="number != null">number,</if>
|
||||||
|
<if test="quantity != null">quantity,</if>
|
||||||
|
<if test="edibleDate != null">edible_date,</if>
|
||||||
|
<if test="edibleType != null">edible_type,</if>
|
||||||
|
<if test="heatValue != null">heat_value,</if>
|
||||||
|
<if test="heatGap != null">heat_gap,</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="delFlag != null">del_flag,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="customerId != null">#{customerId},</if>
|
||||||
|
<if test="ingredient != null">#{ingredient},</if>
|
||||||
|
<if test="unit != null">#{unit},</if>
|
||||||
|
<if test="number != null">#{number},</if>
|
||||||
|
<if test="quantity != null">#{quantity},</if>
|
||||||
|
<if test="edibleDate != null">#{edibleDate},</if>
|
||||||
|
<if test="edibleType != null">#{edibleType},</if>
|
||||||
|
<if test="heatValue != null">#{heatValue},</if>
|
||||||
|
<if test="heatGap != null">#{heatGap},</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="delFlag != null">#{delFlag},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysFoodHeatStatistics" parameterType="SysFoodHeatStatistics">
|
||||||
|
update sys_food_heat_statistics
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="customerId != null">customer_id = #{customerId},</if>
|
||||||
|
<if test="ingredient != null">ingredient = #{ingredient},</if>
|
||||||
|
<if test="unit != null">unit = #{unit},</if>
|
||||||
|
<if test="number != null">number = #{number},</if>
|
||||||
|
<if test="quantity != null">quantity = #{quantity},</if>
|
||||||
|
<if test="edibleDate != null">edible_date = #{edibleDate},</if>
|
||||||
|
<if test="edibleType != null">edible_type = #{edibleType},</if>
|
||||||
|
<if test="heatValue != null">heat_value = #{heatValue},</if>
|
||||||
|
<if test="heatGap != null">heat_gap = #{heatGap},</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="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteSysFoodHeatStatisticsById" parameterType="Long">
|
||||||
|
update sys_food_heat_statistics set del_flag = 1 where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteSysFoodHeatStatisticsByIds" parameterType="String">
|
||||||
|
update sys_food_heat_statistics set del_flag = 1 where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertFoodHeatBatch" parameterType="java.util.List">
|
||||||
|
insert into sys_food_heat_statistics(customer_id,ingredient,unit,number,quantity) values
|
||||||
|
<foreach collection ="list" item="food" index= "index" separator =",">
|
||||||
|
(#{food.customerId}, #{food.ingredient},#{food.unit},#{food.number},#{food.quantity})
|
||||||
|
</foreach >
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
@ -44,6 +44,7 @@
|
|||||||
<include refid="selectSysWxFanStatisticsVoExtended"/> where swfs.del_flag = 0
|
<include refid="selectSysWxFanStatisticsVoExtended"/> where swfs.del_flag = 0
|
||||||
<if test="fanTime != null ">and swfs.fan_time = #{fanTime}</if>
|
<if test="fanTime != null ">and swfs.fan_time = #{fanTime}</if>
|
||||||
<if test="userId != null">and su.user_id = #{userId}</if>
|
<if test="userId != null">and su.user_id = #{userId}</if>
|
||||||
|
<if test="accountId != null">and swd.account_id = #{accountId}</if>
|
||||||
<if test="sortFlag == null or sortFlag == 0">
|
<if test="sortFlag == null or sortFlag == 0">
|
||||||
order by swfs.id desc
|
order by swfs.id desc
|
||||||
</if>
|
</if>
|
||||||
|
@ -43,3 +43,12 @@ export function getCustomerBaseMessage(id) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增客户外食热量计算统计
|
||||||
|
export function addFoodHeatStatistics(data) {
|
||||||
|
return request({
|
||||||
|
url: '/investigate/addFoodHeatStatistics',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
53
stdiet-ui/src/api/custom/foodHeatStatistics.js
Normal file
53
stdiet-ui/src/api/custom/foodHeatStatistics.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询外食热量统计列表
|
||||||
|
export function listFoodHeatStatistics(query) {
|
||||||
|
return request({
|
||||||
|
url: '/custom/foodHeatStatistics/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询外食热量统计详细
|
||||||
|
export function getFoodHeatStatistics(id) {
|
||||||
|
return request({
|
||||||
|
url: '/custom/foodHeatStatistics/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增外食热量统计
|
||||||
|
export function addFoodHeatStatistics(data) {
|
||||||
|
return request({
|
||||||
|
url: '/custom/foodHeatStatistics',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改外食热量统计
|
||||||
|
export function updateFoodHeatStatistics(data) {
|
||||||
|
return request({
|
||||||
|
url: '/custom/foodHeatStatistics',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除外食热量统计
|
||||||
|
export function delFoodHeatStatistics(id) {
|
||||||
|
return request({
|
||||||
|
url: '/custom/foodHeatStatistics/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出外食热量统计
|
||||||
|
export function exportFoodHeatStatistics(query) {
|
||||||
|
return request({
|
||||||
|
url: '/custom/foodHeatStatistics/export',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
148
stdiet-ui/src/components/HeatStatisticsDrawer/index.vue
Normal file
148
stdiet-ui/src/components/HeatStatisticsDrawer/index.vue
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-drawer
|
||||||
|
:title="title"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:visible.sync="visible"
|
||||||
|
@closed="handleOnClosed"
|
||||||
|
size="40%"
|
||||||
|
>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button icon="el-icon-share" size="small" title="点击复制链接" class="copyBtn" type="primary" :data-clipboard-text="copyValue" @click="handleCopy()">外食计算器</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-table :data="foodHeatStatisticsList" >
|
||||||
|
<el-table-column label="日期" align="center" prop="edibleDate" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.edibleDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="食材" align="center" prop="ingredient" />
|
||||||
|
<el-table-column label="通俗质量" align="center" prop="unitName">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.number + "" + scope.row.unitName }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="质量(克)" align="center" prop="quantity" />
|
||||||
|
|
||||||
|
<!--<el-table-column label="类型,0早 1中 2晚" align="center" prop="edibleType" />-->
|
||||||
|
<el-table-column label="热量数值" align="center" prop="heatValue" />
|
||||||
|
<el-table-column label="热量缺口" align="center" prop="heatGap" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<!--<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['custom:foodHeatStatistics:edit']"
|
||||||
|
>修改</el-button>-->
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleOnDeleteClick(scope.row)"
|
||||||
|
v-hasPermi="['custom:foodHeatStatistics:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="fetchHeatList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { listFoodHeatStatistics, getFoodHeatStatistics, delFoodHeatStatistics, addFoodHeatStatistics, updateFoodHeatStatistics, exportFoodHeatStatistics } from "@/api/custom/foodHeatStatistics";
|
||||||
|
import Clipboard from 'clipboard';
|
||||||
|
export default {
|
||||||
|
name: "HeatStatisticsDrawer",
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
title: "",
|
||||||
|
data: undefined,
|
||||||
|
foodHeatStatisticsList: [],
|
||||||
|
total: 0,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
customerId: null,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
copyValue: ""
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showDrawer(data) {
|
||||||
|
// console.log(data);
|
||||||
|
this.data = data;
|
||||||
|
if (!this.data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.title = `「${this.data.name}」热量统计列表`;
|
||||||
|
this.queryParams.customerId = data.id;
|
||||||
|
this.fetchHeatList();
|
||||||
|
},
|
||||||
|
fetchHeatList() {
|
||||||
|
listFoodHeatStatistics(this.queryParams).then(response => {
|
||||||
|
this.foodHeatStatisticsList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.visible = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
|
||||||
|
},
|
||||||
|
handleOnClosed() {
|
||||||
|
this.data = undefined;
|
||||||
|
this.copyValue = "";
|
||||||
|
},
|
||||||
|
handleOnDeleteClick(data) {
|
||||||
|
const ids = data.id || this.ids;
|
||||||
|
this.$confirm(
|
||||||
|
'是否确认删除该数据项?',
|
||||||
|
"警告",
|
||||||
|
{
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(function () {
|
||||||
|
return delFoodHeatStatistics(ids);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.fetchHeatList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
.catch(function () {});
|
||||||
|
},
|
||||||
|
handleCopy() {
|
||||||
|
this.copyValue = window.location.origin.replace('manage', 'sign') + "/foodHeatCalculator/"+this.data.encId;
|
||||||
|
const btnCopy = new Clipboard('.copyBtn');
|
||||||
|
this.$message({
|
||||||
|
message: '拷贝成功',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/deep/ :focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
</style>
|
@ -92,7 +92,7 @@
|
|||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
<!-- 新增订单 -->
|
<!-- 新增订单 -->
|
||||||
<create-order-dialog ref="cusCreateOrderDialogRef" />
|
<!--<create-order-dialog ref="cusCreateOrderDialogRef" />-->
|
||||||
<!-- 订单编辑 -->
|
<!-- 订单编辑 -->
|
||||||
<edit-order-dialog ref="cusEditOrderDialogRef" />
|
<edit-order-dialog ref="cusEditOrderDialogRef" />
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
"edit-order-dialog": OrderEdit,
|
"edit-order-dialog": OrderEdit,
|
||||||
"order-detail": OrderDetail,
|
"order-detail": OrderDetail,
|
||||||
"create-order-dialog": OrderAdd
|
//"create-order-dialog": OrderAdd
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -154,13 +154,13 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.$refs.cusCreateOrderDialogRef.showDialog(
|
this.$refs.cusEditOrderDialogRef.showDialog(
|
||||||
{
|
{
|
||||||
customer: this.data.name,
|
customer: this.data.name,
|
||||||
cusId: this.data.id,
|
cusId: this.data.id,
|
||||||
preSaleId: this.data.salesman,
|
preSaleId: this.data.salesman,
|
||||||
afterSaleId: this.data.afterDietitian,
|
afterSaleId: this.data.afterDietitian,
|
||||||
nutritionistId: [this.data.mainDietitian],
|
nutritionistId: this.data.mainDietitian,
|
||||||
nutriAssisId: this.data.assistantDietitian,
|
nutriAssisId: this.data.assistantDietitian,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
@ -203,8 +203,7 @@ export default {
|
|||||||
["medicalReport_one","medicalReport_two","medicalReport_three"]
|
["medicalReport_one","medicalReport_two","medicalReport_three"]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
copyValue: "",
|
copyValue: ""
|
||||||
enc_id: ""
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -245,7 +244,7 @@ export default {
|
|||||||
this.getDataListBySignMessage(res.data.customerHealthy)
|
this.getDataListBySignMessage(res.data.customerHealthy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.enc_id = res.data.enc_id;
|
//this.enc_id = res.data.enc_id;
|
||||||
this.showFlag = true;
|
this.showFlag = true;
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
});
|
});
|
||||||
@ -253,7 +252,7 @@ export default {
|
|||||||
onClosed() {
|
onClosed() {
|
||||||
this.dataList = [];
|
this.dataList = [];
|
||||||
this.data = null;
|
this.data = null;
|
||||||
this.enc_id = "";
|
//this.enc_id = "";
|
||||||
this.copyValue = "";
|
this.copyValue = "";
|
||||||
},
|
},
|
||||||
//对体征信息进行处理
|
//对体征信息进行处理
|
||||||
@ -437,7 +436,7 @@ export default {
|
|||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
handleCopy() {
|
handleCopy() {
|
||||||
this.copyValue = window.location.origin.replace('manage', 'sign') + "/subhealthyInvestigation/"+this.enc_id;
|
this.copyValue = window.location.origin.replace('manage', 'sign') + "/subhealthyInvestigation/"+this.data.encId;
|
||||||
const btnCopy = new Clipboard('.copyBtn');
|
const btnCopy = new Clipboard('.copyBtn');
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '拷贝成功',
|
message: '拷贝成功',
|
||||||
|
@ -49,7 +49,8 @@ router.beforeEach((to, from, next) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 没有token
|
// 没有token
|
||||||
if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/') || to.path.startsWith('/subhealthyInvestigation/')) {
|
if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/') || to.path.startsWith('/subhealthyInvestigation/')
|
||||||
|
|| to.path.startsWith('/foodHeatCalculator/')) {
|
||||||
// 在免登录白名单,直接进入
|
// 在免登录白名单,直接进入
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
|
@ -173,7 +173,15 @@ export const constantRoutes = [
|
|||||||
require(["@/views/custom/subhealthy/investigation"], resolve),
|
require(["@/views/custom/subhealthy/investigation"], resolve),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
meta: { title: "胜唐体控健康评估表" }
|
meta: { title: "胜唐体控健康评估表" }
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
path: "/foodHeatCalculator/:id",
|
||||||
|
component: resolve =>
|
||||||
|
require(["@/views/custom/foodHeatStatistics/investigate"], resolve),
|
||||||
|
hidden: true,
|
||||||
|
meta: { title: "外食计算器" }
|
||||||
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
|
@ -179,6 +179,16 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="外食热量统计" align="center" v-hasPermi="['custom:foodHeatStatistics:list']">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="handleClickHeatStatistics(scope.row)"
|
||||||
|
>详情
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="食谱计划" align="center" v-hasPermi="['recipes:recipesPlan:list']">
|
<el-table-column label="食谱计划" align="center" v-hasPermi="['recipes:recipesPlan:list']">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -312,6 +322,8 @@
|
|||||||
<contract-drawer ref="cusContractDrawerRef"></contract-drawer>
|
<contract-drawer ref="cusContractDrawerRef"></contract-drawer>
|
||||||
<!-- 健康评估弹窗 -->
|
<!-- 健康评估弹窗 -->
|
||||||
<physical-signs-dialog ref="physicalSignsDialogRef" />
|
<physical-signs-dialog ref="physicalSignsDialogRef" />
|
||||||
|
<!-- 外食热量统计 -->
|
||||||
|
<heatStatisticsDrawer ref="heatStatisticsRef"></heatStatisticsDrawer>
|
||||||
<!-- 食谱计划抽屉 -->
|
<!-- 食谱计划抽屉 -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -333,13 +345,15 @@ import { getOptions } from "@/api/custom/order";
|
|||||||
import OrderDrawer from "@/components/OrderDrawer";
|
import OrderDrawer from "@/components/OrderDrawer";
|
||||||
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
|
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
|
||||||
import ContractDrawer from "@/components/ContractDrawer";
|
import ContractDrawer from "@/components/ContractDrawer";
|
||||||
|
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Customer",
|
name: "Customer",
|
||||||
components: {
|
components: {
|
||||||
"order-drawer": OrderDrawer,
|
"order-drawer": OrderDrawer,
|
||||||
"physical-signs-dialog": PhysicalSignsDialog,
|
"physical-signs-dialog": PhysicalSignsDialog,
|
||||||
"contract-drawer": ContractDrawer
|
"contract-drawer": ContractDrawer,
|
||||||
|
"heatStatisticsDrawer": HeatStatisticsDrawer
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const userId = store.getters && store.getters.userId;
|
const userId = store.getters && store.getters.userId;
|
||||||
@ -490,6 +504,9 @@ export default {
|
|||||||
handleOnMenuClick(row) {
|
handleOnMenuClick(row) {
|
||||||
// console.log(row);
|
// console.log(row);
|
||||||
},
|
},
|
||||||
|
handleClickHeatStatistics(row){
|
||||||
|
this.$refs["heatStatisticsRef"].showDrawer(row);
|
||||||
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
placeholder="选择日期">
|
placeholder="选择日期">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="销售" prop="userId">
|
<el-form-item label="销售" prop="userId" label-width="68px">
|
||||||
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable>
|
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in preSaleIdOptions"
|
v-for="dict in preSaleIdOptions"
|
||||||
@ -19,7 +19,17 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item label="进粉渠道" prop="accountId" label-width="88px">
|
||||||
|
<el-select v-model="queryParams.accountId" filterable placeholder="请选择渠道" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in accountIdOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="parseInt(dict.dictValue)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item style="margin-left: 20px">
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -128,7 +138,7 @@
|
|||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="销售" prop="userId">
|
<el-form-item label="销售" prop="userId">
|
||||||
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small" @change="getWxByUserId">
|
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in preSaleIdOptions"
|
v-for="dict in preSaleIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -218,7 +228,8 @@
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
fanTime: nowDate,
|
fanTime: nowDate,
|
||||||
userId: null
|
userId: null,
|
||||||
|
accountId: null
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
@ -232,6 +243,8 @@
|
|||||||
wxList:[],
|
wxList:[],
|
||||||
//销售列表
|
//销售列表
|
||||||
preSaleIdOptions:[],
|
preSaleIdOptions:[],
|
||||||
|
//进粉渠道列表
|
||||||
|
accountIdOptions:[],
|
||||||
editOpen: false,
|
editOpen: false,
|
||||||
editForm:{},
|
editForm:{},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
@ -244,6 +257,9 @@
|
|||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getSaleUserList();
|
this.getSaleUserList();
|
||||||
|
this.getDicts("fan_channel").then((response) => {
|
||||||
|
this.accountIdOptions = response.data;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询进粉统计列表 */
|
/** 查询进粉统计列表 */
|
||||||
@ -444,6 +460,12 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听用户ID变化
|
||||||
|
"form.userId": function (newVal, oldVal) {
|
||||||
|
this.getWxByUserId(newVal);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
21
stdiet-ui/src/views/custom/foodHeatStatistics/index.vue
Normal file
21
stdiet-ui/src/views/custom/foodHeatStatistics/index.vue
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "index",
|
||||||
|
data() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,252 @@
|
|||||||
|
<template>
|
||||||
|
<section>
|
||||||
|
<div style="padding: 5px; text-align: center">
|
||||||
|
<img :src="logo" style="width: 150px; height: 35px" alt="logo" />
|
||||||
|
</div>
|
||||||
|
<!--<div style="margin: 10px 15px 10px 15px;" >
|
||||||
|
<el-steps :active="stepActive" finish-status="success">
|
||||||
|
<el-step v-for="(item,index) in stepArray" title=""></el-step>
|
||||||
|
</el-steps>
|
||||||
|
</div>-->
|
||||||
|
<el-form ref="form" label-position="top" :model="form" :rules="rules" label-width="100px" style="padding: 16px">
|
||||||
|
<div>
|
||||||
|
<h3>个人信息</h3>
|
||||||
|
<!--<div><span>{{form.name}}</span></div>-->
|
||||||
|
</div>
|
||||||
|
<el-form-item label="真实姓名" prop="name">
|
||||||
|
<el-input v-model="customer.name" :readonly="true" placeholder="请输入真实姓名" maxlength="20"/>
|
||||||
|
</el-form-item>
|
||||||
|
<div>
|
||||||
|
<h3>食材记录</h3>
|
||||||
|
<!--<div><span>{{form.name}}</span></div>-->
|
||||||
|
</div>
|
||||||
|
<el-form-item label="已添加的食材" prop="name">
|
||||||
|
<el-tag style="margin-left: 5px"
|
||||||
|
v-for="tag in ingredientTagArray"
|
||||||
|
:key="tag"
|
||||||
|
closable
|
||||||
|
:disable-transitions="false"
|
||||||
|
@close="handleClose(tag)"
|
||||||
|
>
|
||||||
|
{{tag}}
|
||||||
|
</el-tag>
|
||||||
|
<!--<el-tag class="el-icon-plus" style="margin-left: 5px">
|
||||||
|
添加
|
||||||
|
</el-tag>-->
|
||||||
|
</el-form-item>
|
||||||
|
<div>
|
||||||
|
<el-form-item label="食材名称" prop="ingredient">
|
||||||
|
<el-input v-model="form.ingredient" placeholder="请输入食材名称" maxlength="50"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="通俗计量" prop="numberUnit">
|
||||||
|
<el-input-number v-model="form.number" controls-position="right" :controls="false" style="width: 48%" placeholder="请输入食材数量" :step="1" :max="100"></el-input-number>
|
||||||
|
<el-select v-model="form.unit" placeholder="请选择单位" style="margin-left:5px;width: 50%" filterable clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in cusUnitOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="parseInt(dict.dictValue)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="重量(克)" prop="quantity">
|
||||||
|
<el-input type="number" v-model="form.quantity" placeholder="请输入食材重量(整数)" maxlength="10"/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<el-form-item style="text-align: center; margin: 40px auto" >
|
||||||
|
<el-button type="primary" @click="continueAdd()" >继续添加</el-button>
|
||||||
|
<el-button type="success" @click="submit()" >提交数据</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { getDictData,getCustomerBaseMessage,addFoodHeatStatistics } from "@/api/custom/customerInvestigation";
|
||||||
|
const logo = require("@/assets/logo/st_logo.png");
|
||||||
|
export default {
|
||||||
|
name: "index",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
logo,
|
||||||
|
timer: null,
|
||||||
|
customerExistFlag: false,
|
||||||
|
submitFlag: false,
|
||||||
|
customer:{
|
||||||
|
customerEncId: null,
|
||||||
|
name: null,
|
||||||
|
phone: null
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
ingredient: null,
|
||||||
|
number: 0,
|
||||||
|
unit: null,
|
||||||
|
quantity: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
ingredient: [{ required: true, trigger: "blur", message: "请输入食材名称" }]
|
||||||
|
},
|
||||||
|
ingredientTagArray:[
|
||||||
|
|
||||||
|
],
|
||||||
|
ingredientArray: [
|
||||||
|
|
||||||
|
],
|
||||||
|
//通俗计量单位
|
||||||
|
cusUnitOptions:[]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//根据用户ID获取用户基本信息(手机号、姓名)
|
||||||
|
getCustomerBase(id){
|
||||||
|
if(id == null || id == undefined){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getCustomerBaseMessage(id).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
if(response.data){
|
||||||
|
this.customerExistFlag = true;
|
||||||
|
this.customer.name = response.data.name;
|
||||||
|
this.customer.phone = response.data.phone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(function() {
|
||||||
|
console.log("error");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
continueAdd(){
|
||||||
|
this.$refs.form.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if(this.ingredientTagArray.indexOf(this.form.ingredient.trim()) == -1){
|
||||||
|
this.ingredientArray.push(this.form);
|
||||||
|
this.ingredientTagArray.push(this.form.ingredient);
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message({message: "食材数据未填写完整", type: "warning"});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
reset(){
|
||||||
|
this.form = {
|
||||||
|
ingredient: null,
|
||||||
|
number: 0,
|
||||||
|
unit: null,
|
||||||
|
quantity: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submit(){
|
||||||
|
if (this.submitFlag) {
|
||||||
|
this.$message({
|
||||||
|
message: "请勿重复提交,1分钟后重试",
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.timer = setTimeout(function(){
|
||||||
|
this.submitFlag = false;
|
||||||
|
},1000*60);
|
||||||
|
if(this.form.ingredient && this.ingredientTagArray.indexOf(this.form.ingredient.trim()) == -1){
|
||||||
|
this.ingredientArray.push(this.form);
|
||||||
|
this.ingredientTagArray.push(this.form.ingredient);
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
if(this.ingredientArray.length == 0){
|
||||||
|
this.$message({message: "还未添加食材数据,无法提交", type: "warning"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let submitObject = {};
|
||||||
|
submitObject.ingredientArray = JSON.stringify(this.ingredientArray);
|
||||||
|
submitObject.customerEncId = this.customer.customerEncId;
|
||||||
|
this.submitFlag = true;
|
||||||
|
addFoodHeatStatistics(submitObject).then((response) => {
|
||||||
|
this.$notify({title: "提交成功", message: "", type: "success"});
|
||||||
|
}).catch(function() {
|
||||||
|
console.log("error");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClose(tag) {
|
||||||
|
this.ingredientTagArray.splice(this.ingredientTagArray.indexOf(tag), 1);
|
||||||
|
let tagIndex = -1;
|
||||||
|
this.ingredientArray.forEach((item, index) => {
|
||||||
|
if(tag == item.ingredient){
|
||||||
|
tagIndex = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.ingredientArray.splice(tagIndex, 1);
|
||||||
|
console.log( JSON.stringify(this.ingredientArray))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.customer.customerEncId = this.$route.params.id;
|
||||||
|
this.getCustomerBase(this.customer.customerEncId);
|
||||||
|
getDictData("cus_cus_unit").then(response => {
|
||||||
|
this.cusUnitOptions = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeCreate() {
|
||||||
|
document.title = this.$route.meta.title;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p_title_1{
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
.p_title_2{
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
.p_title_3{
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
.margin-left{
|
||||||
|
margin-left: 14px;
|
||||||
|
}
|
||||||
|
.el-input__inner{
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
.margin-top-10{
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.width-50-left-8-right-5{
|
||||||
|
width:50%;
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.width-70-left-8-right-5{
|
||||||
|
width:70%;
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-tag + .el-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
.button-new-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 30px;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
.input-new-tag {
|
||||||
|
width: 90px;
|
||||||
|
margin-left: 10px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
x
Reference in New Issue
Block a user