Merge branch 'master' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
commit
9de0e2bffc
@ -148,6 +148,7 @@ mybatis:
|
|||||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
# 加载全局的配置文件
|
# 加载全局的配置文件
|
||||||
configLocation: classpath:mybatis/mybatis-config.xml
|
configLocation: classpath:mybatis/mybatis-config.xml
|
||||||
|
typeHandlersPackage: com.stdiet.**.typehandler
|
||||||
|
|
||||||
# PageHelper分页插件
|
# PageHelper分页插件
|
||||||
pagehelper:
|
pagehelper:
|
||||||
|
@ -148,6 +148,7 @@ mybatis:
|
|||||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
# 加载全局的配置文件
|
# 加载全局的配置文件
|
||||||
configLocation: classpath:mybatis/mybatis-config.xml
|
configLocation: classpath:mybatis/mybatis-config.xml
|
||||||
|
typeHandlersPackage: com.stdiet.**.typehandler
|
||||||
|
|
||||||
# PageHelper分页插件
|
# PageHelper分页插件
|
||||||
pagehelper:
|
pagehelper:
|
||||||
|
@ -148,6 +148,7 @@ mybatis:
|
|||||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||||
# 加载全局的配置文件
|
# 加载全局的配置文件
|
||||||
configLocation: classpath:mybatis/mybatis-config.xml
|
configLocation: classpath:mybatis/mybatis-config.xml
|
||||||
|
typeHandlersPackage: com.stdiet.**.typehandler
|
||||||
|
|
||||||
# PageHelper分页插件
|
# PageHelper分页插件
|
||||||
pagehelper:
|
pagehelper:
|
||||||
|
@ -1,23 +1,82 @@
|
|||||||
package com.stdiet.web.controller.custom;
|
package com.stdiet.web.controller.custom;
|
||||||
|
|
||||||
|
import com.stdiet.common.annotation.Log;
|
||||||
import com.stdiet.common.core.controller.BaseController;
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
|
import com.stdiet.common.enums.BusinessType;
|
||||||
|
import com.stdiet.custom.domain.SysRecipes;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesDailyDishes;
|
||||||
import com.stdiet.custom.service.ISysRecipesService;
|
import com.stdiet.custom.service.ISysRecipesService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/recipes")
|
@RequestMapping("/custom/recipes")
|
||||||
public class SysRecipesController extends BaseController {
|
public class SysRecipesController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysRecipesService sysRecipesService;
|
private ISysRecipesService sysRecipesService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取食谱详情
|
||||||
|
*
|
||||||
|
* @param resipesId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping(value = "/{resipesId}")
|
@GetMapping(value = "/{resipesId}")
|
||||||
public AjaxResult getInfo(@PathVariable("resipesId") Long resipesId) {
|
public AjaxResult getInfo(@PathVariable("resipesId") Long resipesId) {
|
||||||
return AjaxResult.success(sysRecipesService.selectSysRecipesByRecipesId(resipesId));
|
return AjaxResult.success(sysRecipesService.selectSysRecipesByRecipesId(resipesId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log(title = "食谱", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult addRecipes(@RequestBody SysRecipes sysRecipes) {
|
||||||
|
int rows = sysRecipesService.addRecipes(sysRecipes);
|
||||||
|
if (rows > 0) {
|
||||||
|
return AjaxResult.success(sysRecipes.getId());
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改食谱菜品
|
||||||
|
*
|
||||||
|
* @param sysRecipesDailyDishes
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "食谱菜品", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping(value = "/dishes")
|
||||||
|
public AjaxResult edit(@RequestBody SysRecipesDailyDishes sysRecipesDailyDishes) {
|
||||||
|
return toAjax(sysRecipesService.updateDishesDetail(sysRecipesDailyDishes));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加菜品
|
||||||
|
*
|
||||||
|
* @param sysRecipesDailyDishes
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "食谱菜品", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping(value = "/dishes")
|
||||||
|
public AjaxResult add(@RequestBody SysRecipesDailyDishes sysRecipesDailyDishes) {
|
||||||
|
int rows = sysRecipesService.addDishes(sysRecipesDailyDishes);
|
||||||
|
if (rows > 0) {
|
||||||
|
return AjaxResult.success(sysRecipesDailyDishes.getId());
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除菜品
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "食谱菜品", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/dishes/{id}")
|
||||||
|
public AjaxResult delete(@PathVariable Long id) {
|
||||||
|
return toAjax(sysRecipesService.deleteDishes(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.stdiet.custom.domain;
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.stdiet.common.annotation.Excel;
|
import com.stdiet.common.annotation.Excel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -74,6 +75,4 @@ public class SysDishes {
|
|||||||
|
|
||||||
private List<SysDishesIngredient> igdList;
|
private List<SysDishesIngredient> igdList;
|
||||||
|
|
||||||
private List<SysDishesIngredient> detail;
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,8 +1,6 @@
|
|||||||
package com.stdiet.custom.domain;
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@ -27,4 +25,11 @@ public class SysDishesIngredient extends SysIngredient {
|
|||||||
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String cus_unit;
|
||||||
|
|
||||||
|
private String cus_weight;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,47 +1,17 @@
|
|||||||
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.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SysRecipes {
|
public class SysRecipes {
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private Integer numDay;
|
private Long cusId;
|
||||||
|
|
||||||
private List<SysDishes> dishes;
|
private Long planId;
|
||||||
|
|
||||||
private Integer reviewStatus;
|
private List<SysRecipesDaily> menus;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建者
|
|
||||||
*/
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新者
|
|
||||||
*/
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysRecipesDaily {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Integer numDay;
|
||||||
|
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
private Long recipesId;
|
||||||
|
|
||||||
|
private Long cusId;
|
||||||
|
|
||||||
|
private Integer reviewStatus;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private List<SysRecipesDailyDishes> dishes;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysRecipesDailyDishes {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long menuId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Long dishesId;
|
||||||
|
|
||||||
|
private JSONArray detail;
|
||||||
|
|
||||||
|
private String methods;
|
||||||
|
|
||||||
|
private List<SysDishesIngredient> igdList;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private Integer isMain;
|
||||||
|
}
|
@ -26,6 +26,8 @@ public class SysRecipesPlan extends BaseEntity
|
|||||||
//@Excel(name = "订单ID")
|
//@Excel(name = "订单ID")
|
||||||
private Long orderId;
|
private Long orderId;
|
||||||
|
|
||||||
|
private Long cusId;
|
||||||
|
|
||||||
//客户ID
|
//客户ID
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|
||||||
|
@ -1,10 +1,28 @@
|
|||||||
package com.stdiet.custom.mapper;
|
package com.stdiet.custom.mapper;
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysRecipes;
|
import com.stdiet.custom.domain.SysRecipes;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesDaily;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesDailyDishes;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface SysRecipesMapper {
|
public interface SysRecipesMapper {
|
||||||
|
|
||||||
|
|
||||||
|
public int addRecipes(SysRecipes sysRecipes);
|
||||||
|
|
||||||
|
public int bashAddDishes(List<SysRecipesDailyDishes> dishes);
|
||||||
|
|
||||||
|
public int bashAddMenus(List<SysRecipesDaily> menus);
|
||||||
|
|
||||||
|
|
||||||
|
public int getNumDayByCusId(Long id);
|
||||||
|
|
||||||
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
|
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
|
||||||
|
|
||||||
|
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDaily);
|
||||||
|
|
||||||
|
public int addDishes(SysRecipesDailyDishes sysRecipesDaily);
|
||||||
|
|
||||||
|
public int deleteDishes(Long id);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,20 @@
|
|||||||
package com.stdiet.custom.service;
|
package com.stdiet.custom.service;
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysRecipes;
|
import com.stdiet.custom.domain.SysRecipes;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesDaily;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesDailyDishes;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface ISysRecipesService {
|
public interface ISysRecipesService {
|
||||||
|
|
||||||
|
public int addRecipes(SysRecipes sysRecipes);
|
||||||
|
|
||||||
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
|
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
|
||||||
|
|
||||||
|
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDaily);
|
||||||
|
|
||||||
|
public int addDishes(SysRecipesDailyDishes sysRecipesDaily);
|
||||||
|
|
||||||
|
public int deleteDishes(Long id);
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
|
import com.stdiet.common.utils.DateUtils;
|
||||||
|
import com.stdiet.common.utils.SynchrolockUtil;
|
||||||
|
import com.stdiet.custom.domain.SysOrder;
|
||||||
|
import com.stdiet.custom.domain.SysOrderPause;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||||
|
import com.stdiet.custom.service.ISysOrderPauseService;
|
||||||
|
import com.stdiet.custom.service.ISysOrderService;
|
||||||
|
import com.stdiet.custom.service.ISysRecipesPlanService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.stdiet.common.utils.DateUtils;
|
|
||||||
import com.stdiet.common.utils.SynchrolockUtil;
|
|
||||||
import com.stdiet.custom.domain.SysOrder;
|
|
||||||
import com.stdiet.custom.domain.SysOrderPause;
|
|
||||||
import com.stdiet.custom.service.ISysOrderPauseService;
|
|
||||||
import com.stdiet.custom.service.ISysOrderService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.annotation.QueryAnnotation;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
|
||||||
import com.stdiet.custom.service.ISysRecipesPlanService;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食谱计划Service业务层处理
|
* 食谱计划Service业务层处理
|
||||||
@ -28,22 +28,17 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*/
|
*/
|
||||||
@Service("sysRecipesPlanService")
|
@Service("sysRecipesPlanService")
|
||||||
@Transactional
|
@Transactional
|
||||||
public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||||
{
|
public static final String generateRecipesPlanLockKey = "generateRecipesPlanLock::%s";
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRecipesPlanMapper sysRecipesPlanMapper;
|
private SysRecipesPlanMapper sysRecipesPlanMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysOrderService sysOrderService;
|
private ISysOrderService sysOrderService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysOrderPauseService sysOrderPauseService;
|
private ISysOrderPauseService sysOrderPauseService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SynchrolockUtil synchrolockUtil;
|
private SynchrolockUtil synchrolockUtil;
|
||||||
|
|
||||||
public static final String generateRecipesPlanLockKey = "generateRecipesPlanLock::%s";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询食谱计划
|
* 查询食谱计划
|
||||||
*
|
*
|
||||||
@ -51,8 +46,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
* @return 食谱计划
|
* @return 食谱计划
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysRecipesPlan selectSysRecipesPlanById(Long id)
|
public SysRecipesPlan selectSysRecipesPlanById(Long id) {
|
||||||
{
|
|
||||||
return sysRecipesPlanMapper.selectSysRecipesPlanById(id);
|
return sysRecipesPlanMapper.selectSysRecipesPlanById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +57,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
* @return 食谱计划
|
* @return 食谱计划
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysRecipesPlan> selectSysRecipesPlanList(SysRecipesPlan sysRecipesPlan)
|
public List<SysRecipesPlan> selectSysRecipesPlanList(SysRecipesPlan sysRecipesPlan) {
|
||||||
{
|
|
||||||
return sysRecipesPlanMapper.selectSysRecipesPlanList(sysRecipesPlan);
|
return sysRecipesPlanMapper.selectSysRecipesPlanList(sysRecipesPlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +68,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertSysRecipesPlan(SysRecipesPlan sysRecipesPlan)
|
public int insertSysRecipesPlan(SysRecipesPlan sysRecipesPlan) {
|
||||||
{
|
|
||||||
sysRecipesPlan.setCreateTime(DateUtils.getNowDate());
|
sysRecipesPlan.setCreateTime(DateUtils.getNowDate());
|
||||||
return sysRecipesPlanMapper.insertSysRecipesPlan(sysRecipesPlan);
|
return sysRecipesPlanMapper.insertSysRecipesPlan(sysRecipesPlan);
|
||||||
}
|
}
|
||||||
@ -88,8 +80,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateSysRecipesPlan(SysRecipesPlan sysRecipesPlan)
|
public int updateSysRecipesPlan(SysRecipesPlan sysRecipesPlan) {
|
||||||
{
|
|
||||||
sysRecipesPlan.setUpdateTime(DateUtils.getNowDate());
|
sysRecipesPlan.setUpdateTime(DateUtils.getNowDate());
|
||||||
//目前只能修改发送状态,所以修改时加上发送时间
|
//目前只能修改发送状态,所以修改时加上发送时间
|
||||||
sysRecipesPlan.setSendTime(DateUtils.getNowDate());
|
sysRecipesPlan.setSendTime(DateUtils.getNowDate());
|
||||||
@ -103,8 +94,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSysRecipesPlanByIds(Long[] ids)
|
public int deleteSysRecipesPlanByIds(Long[] ids) {
|
||||||
{
|
|
||||||
return sysRecipesPlanMapper.deleteSysRecipesPlanByIds(ids);
|
return sysRecipesPlanMapper.deleteSysRecipesPlanByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,8 +105,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSysRecipesPlanById(Long id)
|
public int deleteSysRecipesPlanById(Long id) {
|
||||||
{
|
|
||||||
return sysRecipesPlanMapper.deleteSysRecipesPlanById(id);
|
return sysRecipesPlanMapper.deleteSysRecipesPlanById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +126,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
if (sysOrder == null && DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear() < 2021) {
|
if (sysOrder == null && DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear() < 2021) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.println(DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear());
|
// System.out.println(DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear());
|
||||||
try {
|
try {
|
||||||
//获取redis中该订单对应的锁
|
//获取redis中该订单对应的锁
|
||||||
if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, orderId))) {
|
if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, orderId))) {
|
||||||
@ -159,7 +148,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
pauseParam.setOrderId(sysOrder.getOrderId());
|
pauseParam.setOrderId(sysOrder.getOrderId());
|
||||||
//暂停记录列表
|
//暂停记录列表
|
||||||
List<SysOrderPause> pauseList = sysOrderPauseService.selectSysOrderPauseList(pauseParam);
|
List<SysOrderPause> pauseList = sysOrderPauseService.selectSysOrderPauseList(pauseParam);
|
||||||
List<SysRecipesPlan> planList = generatePlan(orderId, oldRecipesPlanList, DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList);
|
List<SysRecipesPlan> planList = generatePlan(sysOrder, oldRecipesPlanList,
|
||||||
|
DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList);
|
||||||
if (planList != null && planList.size() > 0) {
|
if (planList != null && planList.size() > 0) {
|
||||||
sysRecipesPlanMapper.insertBatch(planList);
|
sysRecipesPlanMapper.insertBatch(planList);
|
||||||
}
|
}
|
||||||
@ -167,8 +157,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
getTestDate(sysRecipesPlan.getStartDate(), sysRecipesPlan.getEndDate());
|
getTestDate(sysRecipesPlan.getStartDate(), sysRecipesPlan.getEndDate());
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
// 一定要释放锁
|
// 一定要释放锁
|
||||||
@ -186,14 +175,16 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单ID、订单开始服务时间、结束时间、暂停列表生成食谱计划列表
|
* 根据订单ID、订单开始服务时间、结束时间、暂停列表生成食谱计划列表
|
||||||
* @param orderId 订单ID
|
*
|
||||||
|
* @param sysOrder 订单对象
|
||||||
* @param oldRecipesPlanList 旧的食谱计划
|
* @param oldRecipesPlanList 旧的食谱计划
|
||||||
* @param serverStartDate 服务开始时间
|
* @param serverStartDate 服务开始时间
|
||||||
* @param serverEndDate 服务结束时间
|
* @param serverEndDate 服务结束时间
|
||||||
* @param pauseList 暂停列表
|
* @param pauseList 暂停列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<SysRecipesPlan> generatePlan(Long orderId, List<SysRecipesPlan> oldRecipesPlanList, LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList){
|
public List<SysRecipesPlan> generatePlan(SysOrder sysOrder, List<SysRecipesPlan> oldRecipesPlanList,
|
||||||
|
LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList) {
|
||||||
List<SysRecipesPlan> planList = new ArrayList<>();
|
List<SysRecipesPlan> planList = new ArrayList<>();
|
||||||
boolean breakFlag = false;
|
boolean breakFlag = false;
|
||||||
LocalDate planStartDate = serverStartDate;
|
LocalDate planStartDate = serverStartDate;
|
||||||
@ -210,7 +201,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
planEndDate = planEndDate.plusDays(pauseDay);
|
planEndDate = planEndDate.plusDays(pauseDay);
|
||||||
sysRecipesPlan.setStartDate(DateUtils.localDateToDate(planStartDate));
|
sysRecipesPlan.setStartDate(DateUtils.localDateToDate(planStartDate));
|
||||||
sysRecipesPlan.setEndDate(DateUtils.localDateToDate(planEndDate));
|
sysRecipesPlan.setEndDate(DateUtils.localDateToDate(planEndDate));
|
||||||
sysRecipesPlan.setOrderId(orderId);
|
sysRecipesPlan.setOrderId(sysOrder.getOrderId());
|
||||||
|
sysRecipesPlan.setCusId(sysOrder.getCusId());
|
||||||
/*//当开始时间小于等于当前时间,默认为已发送,发送时间为前一天
|
/*//当开始时间小于等于当前时间,默认为已发送,发送时间为前一天
|
||||||
if(ChronoUnit.DAYS.between(planStartDate, LocalDate.now()) >= 0){
|
if(ChronoUnit.DAYS.between(planStartDate, LocalDate.now()) >= 0){
|
||||||
sysRecipesPlan.setSendFlag(1);
|
sysRecipesPlan.setSendFlag(1);
|
||||||
@ -236,6 +228,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据食谱开始时间、结束时间、暂停列表获取在食谱计划范围内的暂停天数
|
* 根据食谱开始时间、结束时间、暂停列表获取在食谱计划范围内的暂停天数
|
||||||
|
*
|
||||||
* @param planStartDate 计划开始时间
|
* @param planStartDate 计划开始时间
|
||||||
* @param planEndDate 计划结束时间
|
* @param planEndDate 计划结束时间
|
||||||
* @param pauseList 暂停列表
|
* @param pauseList 暂停列表
|
||||||
@ -265,6 +258,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单ID删除所有食谱安排计划
|
* 根据订单ID删除所有食谱安排计划
|
||||||
|
*
|
||||||
* @param orderIds 订单ID
|
* @param orderIds 订单ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -275,6 +269,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 多条件查询食谱计划列表
|
* 多条件查询食谱计划列表
|
||||||
|
*
|
||||||
* @param sysRecipesPlan
|
* @param sysRecipesPlan
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -285,6 +280,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单ID查询食谱计划
|
* 根据订单ID查询食谱计划
|
||||||
|
*
|
||||||
* @param sysRecipesPlan
|
* @param sysRecipesPlan
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysRecipes;
|
import com.stdiet.custom.domain.SysRecipes;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesDaily;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesDailyDishes;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
import com.stdiet.custom.mapper.SysRecipesMapper;
|
import com.stdiet.custom.mapper.SysRecipesMapper;
|
||||||
|
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||||
import com.stdiet.custom.service.ISysRecipesService;
|
import com.stdiet.custom.service.ISysRecipesService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -16,8 +22,64 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SysRecipesMapper sysRecipesMapper;
|
private SysRecipesMapper sysRecipesMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysRecipesPlanMapper sysRecipesPlanMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int addRecipes(SysRecipes sysRecipes) {
|
||||||
|
int rows = sysRecipesMapper.addRecipes(sysRecipes);
|
||||||
|
if (rows > 0) {
|
||||||
|
int count = sysRecipesMapper.getNumDayByCusId(sysRecipes.getCusId());
|
||||||
|
List<SysRecipesDaily> menus = sysRecipes.getMenus();
|
||||||
|
List<SysRecipesDailyDishes> dishes = new ArrayList<>();
|
||||||
|
int size = menus.size();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
SysRecipesDaily tarMenu = menus.get(i);
|
||||||
|
// 计算menuId
|
||||||
|
long dailyId = sysRecipes.getId() + new Date().getTime() + i;
|
||||||
|
tarMenu.setId(dailyId);
|
||||||
|
// 插入recipiesId
|
||||||
|
tarMenu.setRecipesId(sysRecipes.getId());
|
||||||
|
// 插入numDay
|
||||||
|
tarMenu.setNumDay(count + i + 1);
|
||||||
|
for (SysRecipesDailyDishes tmpDishes : tarMenu.getDishes()) {
|
||||||
|
// 让菜品插入menuId
|
||||||
|
tmpDishes.setMenuId(dailyId);
|
||||||
|
dishes.add(tmpDishes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 插入每天食谱
|
||||||
|
sysRecipesMapper.bashAddMenus(menus);
|
||||||
|
// 插入每天菜品
|
||||||
|
sysRecipesMapper.bashAddDishes(dishes);
|
||||||
|
// 更新食谱计划
|
||||||
|
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||||
|
sysRecipesPlan.setId(sysRecipes.getPlanId());
|
||||||
|
sysRecipesPlan.setRecipesId(sysRecipes.getId());
|
||||||
|
sysRecipesPlanMapper.updateSysRecipesPlan(sysRecipesPlan);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysRecipes> selectSysRecipesByRecipesId(Long id) {
|
public List<SysRecipes> selectSysRecipesByRecipesId(Long id) {
|
||||||
return sysRecipesMapper.selectSysRecipesByRecipesId(id);
|
return sysRecipesMapper.selectSysRecipesByRecipesId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDailyDishes) {
|
||||||
|
return sysRecipesMapper.updateDishesDetail(sysRecipesDailyDishes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int addDishes(SysRecipesDailyDishes sysRecipesDailyDishes) {
|
||||||
|
return sysRecipesMapper.addDishes(sysRecipesDailyDishes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteDishes(Long id) {
|
||||||
|
return sysRecipesMapper.deleteDishes(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.stdiet.custom.mapper.SysRecipesMapper">
|
<mapper namespace="com.stdiet.custom.mapper.SysRecipesMapper">
|
||||||
|
|
||||||
<resultMap type="SysRecipes" id="SysRecipesResult">
|
<resultMap type="SysRecipesDaily" id="SysRecipesResult">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="numDay" column="num_day"/>
|
<result property="numDay" column="num_day"/>
|
||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
@ -15,14 +15,16 @@
|
|||||||
<association property="dishes" column="id" select="selectDishesByMenuId"/>
|
<association property="dishes" column="id" select="selectDishesByMenuId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="SysDishesResult" type="SysDishes">
|
<resultMap id="SysDishesResult" type="SysRecipesDailyDishes">
|
||||||
<result property="id" column="dishes_id"/>
|
<result property="dishesId" column="dishes_id"/>
|
||||||
|
<result property="menuId" column="menu_id"/>
|
||||||
|
<result property="id" column="id" />
|
||||||
<result property="name" column="name"/>
|
<result property="name" column="name"/>
|
||||||
<result property="type" column="type"/>
|
<result property="type" column="type"/>
|
||||||
<result property="methods" column="methods"/>
|
<result property="methods" column="methods"/>
|
||||||
<result property="isMain" column="is_main"/>
|
<result property="isMain" column="is_main"/>
|
||||||
<result property="detail" column="detail" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"
|
<result property="detail" column="detail" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"
|
||||||
javaType="com.stdiet.custom.domain.SysDishesIngredientInfo"/>
|
javaType="com.stdiet.custom.domain.SysDishesIngredient"/>
|
||||||
<association property="igdList" column="dishes_id" select="selectIngredientsByDishesId"/>
|
<association property="igdList" column="dishes_id" select="selectIngredientsByDishesId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
@ -76,4 +78,67 @@
|
|||||||
) ing USING(id)
|
) ing USING(id)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 更新菜品-->
|
||||||
|
<update id="updateDishesDetail" parameterType="SysRecipesDailyDishes">
|
||||||
|
update sys_customer_menu_dishes
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="detail != null">detail = #{detail, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 插入菜品-->
|
||||||
|
<insert id="addDishes" parameterType="SysRecipesDailyDishes" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_customer_menu_dishes
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="menuId != null">menu_id,</if>
|
||||||
|
<if test="dishesId != null">dishes_id,</if>
|
||||||
|
<if test="type != null">type,</if>
|
||||||
|
<if test="detail != null">detail,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="menuId != null">#{menuId},</if>
|
||||||
|
<if test="dishesId != null">#{dishesId},</if>
|
||||||
|
<if test="type != null">#{type},</if>
|
||||||
|
<if test="detail != null">#{detail, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 删除菜品-->
|
||||||
|
<delete id="deleteDishes" parameterType="Long">
|
||||||
|
delete from sys_customer_menu_dishes where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!-- 查询已有食谱天数-->
|
||||||
|
<select id="getNumDayByCusId" parameterType="Long" resultType="Integer">
|
||||||
|
select count(*) from sys_customer_daily_menu where cus_id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 新增食谱 -->
|
||||||
|
<insert id="addRecipes" parameterType="SysRecipes" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_customer_menu
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="cusId != null">cus_id,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="cusId != null">#{cusId},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 新增每菜单 -->
|
||||||
|
<insert id="bashAddMenus">
|
||||||
|
insert into sys_customer_daily_menu (id, num_day, date, recipes_id, cus_id) values
|
||||||
|
<foreach collection="list" separator="," item="item" index="index">
|
||||||
|
(#{item.id}, #{item.numDay}, #{item.date}, #{item.recipesId}, #{item.cusId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 新增菜单对应菜品-->
|
||||||
|
<insert id="bashAddDishes" >
|
||||||
|
insert into sys_customer_menu_dishes (menu_id, type, dishes_id, detail) values
|
||||||
|
<foreach collection="list" separator="," item="item" index="index">
|
||||||
|
(#{item.menuId}, #{item.type}, #{item.dishesId}, #{item.detail, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -17,6 +17,7 @@
|
|||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
|
<result property="cusId" column="cus_id" />
|
||||||
<!-- 非持久化字段 -->
|
<!-- 非持久化字段 -->
|
||||||
<result property="customerId" column="cus_id"></result><!-- 客户ID -->
|
<result property="customerId" column="cus_id"></result><!-- 客户ID -->
|
||||||
<result property="customer" column="customer" /><!-- 客户姓名 -->
|
<result property="customer" column="customer" /><!-- 客户姓名 -->
|
||||||
@ -127,7 +128,7 @@
|
|||||||
|
|
||||||
<!-- 食谱计划、订单表联查 -->
|
<!-- 食谱计划、订单表联查 -->
|
||||||
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||||
SELECT srp.id,srp.order_id,sr.customer,sr.cus_id,sr.phone,su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,sr.start_time,sr.server_end_time, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
|
SELECT srp.id,srp.order_id,srp.recipes_id,sr.customer,sr.cus_id,sr.phone,su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,sr.start_time,sr.server_end_time, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
|
||||||
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
|
||||||
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
|
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
|
||||||
|
10
stdiet-ui/jsconfig.json
Normal file
10
stdiet-ui/jsconfig.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -46,13 +46,15 @@
|
|||||||
"clipboard": "^2.0.6",
|
"clipboard": "^2.0.6",
|
||||||
"core-js": "3.6.5",
|
"core-js": "3.6.5",
|
||||||
"dayjs": "^1.9.1",
|
"dayjs": "^1.9.1",
|
||||||
"echarts": "4.2.1",
|
"echarts": "4.7.0",
|
||||||
"element-ui": "2.13.2",
|
"element-ui": "2.13.2",
|
||||||
"file-saver": "2.0.1",
|
"file-saver": "2.0.1",
|
||||||
"fuse.js": "3.4.4",
|
"fuse.js": "3.4.4",
|
||||||
|
"immer": "^8.0.1",
|
||||||
"js-beautify": "1.10.2",
|
"js-beautify": "1.10.2",
|
||||||
"js-cookie": "2.2.0",
|
"js-cookie": "2.2.0",
|
||||||
"jsencrypt": "3.0.0-rc.1",
|
"jsencrypt": "3.0.0-rc.1",
|
||||||
|
"lodash": "^4.17.20",
|
||||||
"normalize.css": "7.0.0",
|
"normalize.css": "7.0.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"path-to-regexp": "2.4.0",
|
"path-to-regexp": "2.4.0",
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App'
|
name: "App",
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
8
stdiet-ui/src/api/custom/global.js
Normal file
8
stdiet-ui/src/api/custom/global.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
export function getOptions() {
|
||||||
|
return request({
|
||||||
|
url: "/custom/post/options",
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
@ -1,69 +1,62 @@
|
|||||||
import request from '@/utils/request'
|
import request from "@/utils/request";
|
||||||
|
|
||||||
// 查询销售订单列表
|
// 查询销售订单列表
|
||||||
export function listOrder(params) {
|
export function listOrder(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/order/list',
|
url: "/custom/order/list",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: params
|
params: params
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询销售订单详细
|
// 查询销售订单详细
|
||||||
export function getOrder(orderId) {
|
export function getOrder(orderId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/order/' + orderId,
|
url: "/custom/order/" + orderId,
|
||||||
method: 'get'
|
method: "get"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增销售订单
|
// 新增销售订单
|
||||||
export function addOrder(data) {
|
export function addOrder(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/order',
|
url: "/custom/order",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改销售订单
|
// 修改销售订单
|
||||||
export function updateOrder(data) {
|
export function updateOrder(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/order',
|
url: "/custom/order",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除销售订单
|
// 删除销售订单
|
||||||
export function delOrder(orderId) {
|
export function delOrder(orderId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/order/' + orderId,
|
url: "/custom/order/" + orderId,
|
||||||
method: 'delete'
|
method: "delete"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出销售订单
|
// 导出销售订单
|
||||||
export function exportOrder(query) {
|
export function exportOrder(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/order/export',
|
url: "/custom/order/export",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query
|
||||||
})
|
});
|
||||||
}
|
|
||||||
|
|
||||||
export function getOptions() {
|
|
||||||
return request({
|
|
||||||
url: '/custom/post/options',
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询销售订单详细
|
// 查询销售订单详细
|
||||||
export function getInfoDetail(query) {
|
export function getInfoDetail(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/order/getInfoDetail',
|
url: "/custom/order/getInfoDetail",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,39 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
|
||||||
export function getRecipes(id) {
|
export function addRecipesApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: "/recipes/" + id,
|
url: "/custom/recipes/",
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRecipesApi(id) {
|
||||||
|
return request({
|
||||||
|
url: "/custom/recipes/" + id,
|
||||||
method: "get"
|
method: "get"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateDishesDetailApi(data) {
|
||||||
|
return request({
|
||||||
|
url: "/custom/recipes/dishes",
|
||||||
|
method: "put",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addDishesApi(data) {
|
||||||
|
return request({
|
||||||
|
url: "/custom/recipes/dishes",
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteDishesApi(id) {
|
||||||
|
return request({
|
||||||
|
url: "/custom/recipes/dishes/" + id,
|
||||||
|
method: "delete"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -3,9 +3,14 @@
|
|||||||
<div v-for="item in mData" :key="item">
|
<div v-for="item in mData" :key="item">
|
||||||
{{ item }}
|
{{ item }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="data.length > 3">
|
<div v-if="data.length > line">
|
||||||
<div>...</div>
|
<div v-if="line > 0">...</div>
|
||||||
<el-popover placement="top-start" width="200" popper-class="autohideinfo_detial" trigger="hover">
|
<el-popover
|
||||||
|
placement="top-start"
|
||||||
|
width="200"
|
||||||
|
popper-class="autohideinfo_detial"
|
||||||
|
trigger="hover"
|
||||||
|
>
|
||||||
<div v-for="item in data" :key="item">{{ item }}</div>
|
<div v-for="item in data" :key="item">{{ item }}</div>
|
||||||
<el-button type="text" slot="reference">详情</el-button>
|
<el-button type="text" slot="reference">详情</el-button>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
@ -17,20 +22,23 @@
|
|||||||
export default {
|
export default {
|
||||||
name: "AutoHideInfo",
|
name: "AutoHideInfo",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {};
|
||||||
};
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: '',
|
default: "",
|
||||||
// required: true,
|
// required: true,
|
||||||
},
|
},
|
||||||
|
line: {
|
||||||
|
type: Number,
|
||||||
|
default: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
mData: function () {
|
mData: function () {
|
||||||
if (this.data instanceof Array) {
|
if (this.data instanceof Array) {
|
||||||
return this.data.slice(0, 3);
|
return this.data.slice(0, this.line);
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
@ -38,9 +46,8 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
.autohideinfo_wrapper {
|
.autohideinfo_wrapper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.autohideinfo_detial {
|
.autohideinfo_detial {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
.autohideinfo_wrapper {
|
.autohideinfo_wrapper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,28 +3,51 @@
|
|||||||
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-form-item label="调理项目" prop="projectId">
|
<el-form-item label="调理项目" prop="projectId">
|
||||||
<el-select v-model="form.projectId" placeholder="请选择调理项目" filterable clearable size="small">
|
<el-select
|
||||||
<el-option v-for="dict in conditioningProjectIdOption"
|
v-model="form.projectId"
|
||||||
|
placeholder="请选择调理项目"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in conditioningProjectIdOption"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="parseInt(dict.dictValue)"/>
|
:value="parseInt(dict.dictValue)"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!--<el-form-item label="客户姓名" prop="name">
|
<!--<el-form-item label="客户姓名" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
|
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
|
||||||
</el-form-item>-->
|
</el-form-item>-->
|
||||||
<el-form-item label="金额" prop="amount" style="width: 300px;">
|
<el-form-item label="金额" prop="amount" style="width: 300px">
|
||||||
<el-input v-model="form.amount" placeholder="请输入金额" />
|
<el-input v-model="form.amount" placeholder="请输入金额" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="服务承诺" prop="servePromise" v-show="form.projectId == 0" >
|
<el-form-item
|
||||||
<el-input style="width: 200px;" v-model="form.servePromise" placeholder="请输入服务承诺"/><span style="margin-left: 5px;">斤</span>
|
label="服务承诺"
|
||||||
|
prop="servePromise"
|
||||||
|
v-show="form.projectId == 0"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
style="width: 200px"
|
||||||
|
v-model="form.servePromise"
|
||||||
|
placeholder="请输入服务承诺"
|
||||||
|
/><span style="margin-left: 5px">斤</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="营养师" prop="nutritionistId">
|
<el-form-item label="营养师" prop="nutritionistId">
|
||||||
<el-select v-model="form.nutritionistId" placeholder="请选择营养师" clearable size="small">
|
<el-select
|
||||||
<el-option v-for="dict in nutritionistIdOptions"
|
v-model="form.nutritionistId"
|
||||||
|
placeholder="请选择营养师"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutritionistIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="parseInt(dict.dictValue)"/>
|
:value="parseInt(dict.dictValue)"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="服务时间" prop="serveTime">
|
<el-form-item label="服务时间" prop="serveTime">
|
||||||
@ -38,7 +61,11 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@ -48,20 +75,17 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { addContract } from "@/api/custom/contract";
|
import { addContract } from "@/api/custom/contract";
|
||||||
import {getOptions} from "@/api/custom/order";
|
import { mapState } from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ContractAdd",
|
name: "ContractAdd",
|
||||||
components: {
|
components: {},
|
||||||
|
|
||||||
},
|
|
||||||
props: {},
|
props: {},
|
||||||
data() {
|
data() {
|
||||||
const checkServePromise = (rule, value, callback) => {
|
const checkServePromise = (rule, value, callback) => {
|
||||||
if (this.form.projectId == 0 && !value) {
|
if (this.form.projectId == 0 && !value) {
|
||||||
return callback(new Error('请输入服务承诺'))
|
return callback(new Error("请输入服务承诺"));
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
};
|
};
|
||||||
@ -76,7 +100,7 @@ export default {
|
|||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
projectId: [
|
projectId: [
|
||||||
{required: true, message: "请选择调理项目", trigger: "blur"}
|
{ required: true, message: "请选择调理项目", trigger: "blur" },
|
||||||
],
|
],
|
||||||
/*name: [
|
/*name: [
|
||||||
{required: true, message: "请输入客户姓名", trigger: "blur"}
|
{required: true, message: "请输入客户姓名", trigger: "blur"}
|
||||||
@ -91,35 +115,31 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
servePromise: [
|
servePromise: [
|
||||||
{required: true, trigger: "blur", validator: checkServePromise}
|
{ required: true, trigger: "blur", validator: checkServePromise },
|
||||||
],
|
],
|
||||||
serveTime: [
|
serveTime: [
|
||||||
{required: true, message: "请选择服务时间", trigger: "blur"}
|
{ required: true, message: "请选择服务时间", trigger: "blur" },
|
||||||
],
|
],
|
||||||
nutritionistId: [
|
nutritionistId: [
|
||||||
{required: true, message: "请选择营养师", trigger: "blur"}
|
{ required: true, message: "请选择营养师", trigger: "blur" },
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
conditioningProjectIdOption: [],
|
conditioningProjectIdOption: [],
|
||||||
serveTimeOptions: [],
|
serveTimeOptions: [],
|
||||||
nutritionistIdOptions:[]
|
// nutritionistIdOptions: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
nutritionistIdOptions: (state) =>
|
||||||
|
state.global.nutritionistIdOptions.slice(1),
|
||||||
|
}),
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
getOptions().then(response => {
|
this.getDicts("cus_serve_time").then((response) => {
|
||||||
const options = response.data.reduce((opts, cur) => {
|
|
||||||
if (!opts[cur.postCode]) {
|
|
||||||
opts[cur.postCode] = [];
|
|
||||||
}
|
|
||||||
opts[cur.postCode].push({dictValue: cur.userId, dictLabel: cur.userName, remark: cur.remark})
|
|
||||||
return opts;
|
|
||||||
}, {})
|
|
||||||
this.nutritionistIdOptions = options['nutri'] || [];
|
|
||||||
})
|
|
||||||
this.getDicts("cus_serve_time").then(response => {
|
|
||||||
this.serveTimeOptions = response.data;
|
this.serveTimeOptions = response.data;
|
||||||
});
|
});
|
||||||
this.getDicts("conditioning_project").then(response => {
|
this.getDicts("conditioning_project").then((response) => {
|
||||||
this.conditioningProjectIdOption = response.data;
|
this.conditioningProjectIdOption = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -132,24 +152,32 @@ export default {
|
|||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset(obj) {
|
reset(obj) {
|
||||||
const defaultNutritionist = this.nutritionistIdOptions.find(opt => opt.dictValue === obj.nutritionistId);
|
const defaultNutritionist = this.nutritionistIdOptions.find(
|
||||||
const defaultProjectIdOption = this.conditioningProjectIdOption.find(opt => opt.remark === 'default');
|
(opt) => opt.dictValue === obj.nutritionistId
|
||||||
|
);
|
||||||
|
const defaultProjectIdOption = this.conditioningProjectIdOption.find(
|
||||||
|
(opt) => opt.remark === "default"
|
||||||
|
);
|
||||||
|
|
||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
customerId: obj.customerId,
|
customerId: obj.customerId,
|
||||||
projectId: defaultProjectIdOption ? parseInt(defaultProjectIdOption.dictValue) : null,
|
projectId: defaultProjectIdOption
|
||||||
|
? parseInt(defaultProjectIdOption.dictValue)
|
||||||
|
: null,
|
||||||
name: obj.customer,
|
name: obj.customer,
|
||||||
phone: null,
|
phone: null,
|
||||||
serveTime: null,
|
serveTime: null,
|
||||||
amount: null,
|
amount: null,
|
||||||
path: null,
|
path: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
nutritionistId: defaultNutritionist ? parseInt(defaultNutritionist.dictValue) : null,
|
nutritionistId: defaultNutritionist
|
||||||
|
? parseInt(defaultNutritionist.dictValue)
|
||||||
|
: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
remark: null
|
remark: null,
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -159,13 +187,16 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form.tutor = this.selectDictLabel(this.nutritionistIdOptions, this.form.nutritionistId)
|
this.form.tutor = this.selectDictLabel(
|
||||||
|
this.nutritionistIdOptions,
|
||||||
|
this.form.nutritionistId
|
||||||
|
);
|
||||||
if (this.form.projectId != 0) {
|
if (this.form.projectId != 0) {
|
||||||
this.form.servePromise = null;
|
this.form.servePromise = null;
|
||||||
}
|
}
|
||||||
addContract(this.form).then(response => {
|
addContract(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -174,7 +205,7 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
:title="title"
|
:title="title"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
:visible.sync="visible"
|
:visible.sync="visible"
|
||||||
|
:wrapperClosable="false"
|
||||||
@closed="handleOnClosed"
|
@closed="handleOnClosed"
|
||||||
size="40%"
|
size="40%"
|
||||||
>
|
>
|
||||||
@ -22,22 +23,48 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table :data="contractList">
|
<el-table :data="contractList">
|
||||||
<el-table-column label="合同编号" align="center" prop="id" width="150"/>
|
<el-table-column
|
||||||
<el-table-column label="合同状态" align="center" prop="status" width="80" >
|
label="合同编号"
|
||||||
|
align="center"
|
||||||
|
prop="id"
|
||||||
|
width="150"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="合同状态"
|
||||||
|
align="center"
|
||||||
|
prop="status"
|
||||||
|
width="80"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag
|
<el-tag
|
||||||
:type="scope.row.status === 'yes' ? 'success' : 'danger'"
|
:type="scope.row.status === 'yes' ? 'success' : 'danger'"
|
||||||
disable-transitions>
|
disable-transitions
|
||||||
{{scope.row.status === 'yes' ? '已签订':'未签订'}}
|
>
|
||||||
|
{{ scope.row.status === "yes" ? "已签订" : "未签订" }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="客户姓名" align="center" prop="name" width="200"/>
|
<el-table-column
|
||||||
|
label="客户姓名"
|
||||||
|
align="center"
|
||||||
|
prop="name"
|
||||||
|
width="200"
|
||||||
|
/>
|
||||||
|
|
||||||
<el-table-column label="合同地址" align="center" prop="path" width="80">
|
<el-table-column
|
||||||
|
label="合同地址"
|
||||||
|
align="center"
|
||||||
|
prop="path"
|
||||||
|
width="80"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" icon="el-icon-copy-document" @click="handleCopy(scope.row.path)" class="copyBtn"
|
<el-button
|
||||||
:data-clipboard-text="copyValue">复制
|
type="text"
|
||||||
|
icon="el-icon-copy-document"
|
||||||
|
@click="handleCopy(scope.row.path)"
|
||||||
|
class="copyBtn"
|
||||||
|
:data-clipboard-text="copyValue"
|
||||||
|
>复制
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -80,14 +107,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import { delContract, listContract } from "@/api/custom/contract";
|
import { delContract, listContract } from "@/api/custom/contract";
|
||||||
import ContractDetail from "@/components/ContractDetail";
|
import ContractDetail from "@/components/ContractDetail";
|
||||||
import Clipboard from 'clipboard';
|
import Clipboard from "clipboard";
|
||||||
import ContractAdd from "@/components/ContractAdd";
|
import ContractAdd from "@/components/ContractAdd";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CustomerContractDrawer",
|
name: "CustomerContractDrawer",
|
||||||
components: {
|
components: {
|
||||||
'contract-detail': ContractDetail,
|
"contract-detail": ContractDetail,
|
||||||
'add-contract':ContractAdd
|
"add-contract": ContractAdd,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -108,7 +135,7 @@ export default {
|
|||||||
this.fetchContractList(data.id);
|
this.fetchContractList(data.id);
|
||||||
},
|
},
|
||||||
fetchContractList(cusId) {
|
fetchContractList(cusId) {
|
||||||
listContract({"customerId": cusId }).then((res) => {
|
listContract({ customerId: cusId }).then((res) => {
|
||||||
this.contractList = res.rows;
|
this.contractList = res.rows;
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
});
|
});
|
||||||
@ -118,7 +145,7 @@ export default {
|
|||||||
{
|
{
|
||||||
customer: this.data.name,
|
customer: this.data.name,
|
||||||
customerId: this.data.id,
|
customerId: this.data.id,
|
||||||
nutritionistId: this.data.mainDietitian
|
nutritionistId: this.data.mainDietitian,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.fetchContractList(this.data.id);
|
this.fetchContractList(this.data.id);
|
||||||
@ -131,9 +158,7 @@ export default {
|
|||||||
handleOnDetailClick(data) {
|
handleOnDetailClick(data) {
|
||||||
this.$refs.contractDetailRef.showDialog(data.id);
|
this.$refs.contractDetailRef.showDialog(data.id);
|
||||||
},
|
},
|
||||||
handleOnEditClick(data) {
|
handleOnEditClick(data) {},
|
||||||
|
|
||||||
},
|
|
||||||
handleOnDeleteClick(data) {
|
handleOnDeleteClick(data) {
|
||||||
const contractIds = data.id;
|
const contractIds = data.id;
|
||||||
this.$confirm(
|
this.$confirm(
|
||||||
@ -155,18 +180,18 @@ export default {
|
|||||||
.catch(function () {});
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
handleCopy(path) {
|
handleCopy(path) {
|
||||||
this.copyValue = window.location.origin.replace('manage', 'sign') + path;
|
this.copyValue = window.location.origin.replace("manage", "sign") + path;
|
||||||
const btnCopy = new Clipboard('.copyBtn');
|
const btnCopy = new Clipboard(".copyBtn");
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '拷贝成功',
|
message: "拷贝成功",
|
||||||
type: 'success'
|
type: "success",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleLook(path) {
|
handleLook(path) {
|
||||||
const url = window.location.origin.replace('manage', 'sign') + path;
|
const url = window.location.origin.replace("manage", "sign") + path;
|
||||||
// const url = "http://stsign.busyinn.com" + path;
|
// const url = "http://stsign.busyinn.com" + path;
|
||||||
window.open(url, '_blank');
|
window.open(url, "_blank");
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -113,7 +113,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
.editor, .ql-toolbar {
|
.editor, .ql-toolbar {
|
||||||
white-space: pre-wrap!important;
|
white-space: pre-wrap!important;
|
||||||
line-height: normal !important;
|
line-height: normal !important;
|
||||||
|
@ -14,13 +14,23 @@
|
|||||||
<el-cascader
|
<el-cascader
|
||||||
v-model="form.orderType"
|
v-model="form.orderType"
|
||||||
:options="orderTypeOptions"
|
:options="orderTypeOptions"
|
||||||
style="width: 100%">
|
style="width: 100%"
|
||||||
|
>
|
||||||
</el-cascader>
|
</el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="自动创建售后提成订单" prop="secondAfterSaleFlag" label-width="200px">
|
<el-form-item
|
||||||
<el-select v-model="form.secondAfterSaleFlag" :disabled="secondAfterSaleFlagShow" style="width: 100px" placeholder="请选择">
|
label="自动创建售后提成订单"
|
||||||
|
prop="secondAfterSaleFlag"
|
||||||
|
label-width="200px"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="form.secondAfterSaleFlag"
|
||||||
|
:disabled="secondAfterSaleFlagShow"
|
||||||
|
style="width: 100px"
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
<el-option :key="0" label="否" :value="0" />
|
<el-option :key="0" label="否" :value="0" />
|
||||||
<el-option :key="1" label="是" :value="1" />
|
<el-option :key="1" label="是" :value="1" />
|
||||||
</el-select>
|
</el-select>
|
||||||
@ -120,7 +130,11 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="主营养师" prop="nutritionistIdList">
|
<el-form-item label="主营养师" prop="nutritionistIdList">
|
||||||
<el-select v-model="form.nutritionistIdList" multiple placeholder="请选择">
|
<el-select
|
||||||
|
v-model="form.nutritionistIdList"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in nutritionistIdOptions"
|
v-for="dict in nutritionistIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -132,7 +146,11 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="拆分比例" prop="nutritionistRate">
|
<el-form-item label="拆分比例" prop="nutritionistRate">
|
||||||
<el-select v-model="form.nutritionistRate" :disabled="orderRateOptionsShow" placeholder="请选择" >
|
<el-select
|
||||||
|
v-model="form.nutritionistRate"
|
||||||
|
:disabled="orderRateOptionsShow"
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in orderRateOptions"
|
v-for="dict in orderRateOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -264,9 +282,11 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { addOrder, getOptions, updateOrder } from "@/api/custom/order";
|
import { addOrder, updateOrder } from "@/api/custom/order";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import * as orderTypeData from "@/utils/orderType";
|
import * as orderTypeData from "@/utils/orderType";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OrderEdit",
|
name: "OrderEdit",
|
||||||
props: {
|
props: {
|
||||||
@ -383,16 +403,6 @@ export default {
|
|||||||
},
|
},
|
||||||
// 收款方式字典
|
// 收款方式字典
|
||||||
payTypeIdOptions: [],
|
payTypeIdOptions: [],
|
||||||
// 售前字典
|
|
||||||
preSaleIdOptions: [],
|
|
||||||
// 售后字典
|
|
||||||
afterSaleIdOptions: [],
|
|
||||||
// 主营养师字典
|
|
||||||
nutritionistIdOptions: [],
|
|
||||||
// 助理营养师字典
|
|
||||||
nutriAssisIdOptions: [],
|
|
||||||
// 策划字典
|
|
||||||
plannerIdOptions: [],
|
|
||||||
// 账号
|
// 账号
|
||||||
accountIdOptions: [],
|
accountIdOptions: [],
|
||||||
// 服务时长
|
// 服务时长
|
||||||
@ -401,54 +411,25 @@ export default {
|
|||||||
giveTimeIdOption: [],
|
giveTimeIdOption: [],
|
||||||
//调理项目
|
//调理项目
|
||||||
conditioningProjectIdOption: [],
|
conditioningProjectIdOption: [],
|
||||||
// 策划助理字典
|
|
||||||
plannerAssisIdOptions: [],
|
|
||||||
// 运营字典
|
|
||||||
operatorIdOptions: [],
|
|
||||||
// 审核状态
|
// 审核状态
|
||||||
reviewStatusOptions: [],
|
reviewStatusOptions: [],
|
||||||
//
|
|
||||||
operatorAssisIdOptions: [],
|
|
||||||
//下拉列表对应关系(用于选择收款账号自动选择策划、策划助理、运营、运营助理)
|
//下拉列表对应关系(用于选择收款账号自动选择策划、策划助理、运营、运营助理)
|
||||||
orderDropdownCorrespondingOptions: [],
|
orderDropdownCorrespondingOptions: [],
|
||||||
//订单类型
|
//订单类型
|
||||||
orderTypeOptions: orderTypeData['orderTypeArray'],
|
orderTypeOptions: orderTypeData["orderTypeArray"],
|
||||||
secondAfterSaleFlagShow: true,
|
secondAfterSaleFlagShow: true,
|
||||||
//分成比例
|
//分成比例
|
||||||
orderRateOptions: orderTypeData['orderRateArray'],
|
orderRateOptions: orderTypeData["orderRateArray"],
|
||||||
orderRateOptionsShow: true
|
orderRateOptionsShow: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
getOptions().then((res) => {
|
|
||||||
const options = res.data.reduce((opts, cur) => {
|
|
||||||
if (!opts[cur.postCode]) {
|
|
||||||
opts[cur.postCode] = [
|
|
||||||
{ dictValue: 0, dictLabel: "无", remark: null },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
opts[cur.postCode].push({
|
|
||||||
dictValue: cur.userId,
|
|
||||||
dictLabel: cur.userName,
|
|
||||||
remark: cur.remark,
|
|
||||||
});
|
|
||||||
return opts;
|
|
||||||
}, {});
|
|
||||||
this.preSaleIdOptions = options["pre_sale"] || [];
|
|
||||||
this.afterSaleIdOptions = options["after_sale"] || [];
|
|
||||||
this.nutritionistIdOptions = options["nutri"] || [];
|
|
||||||
this.nutriAssisIdOptions = options["nutri_assis"] || [];
|
|
||||||
this.plannerIdOptions = options["planner"] || [];
|
|
||||||
this.plannerAssisIdOptions = options["planner_assis"] || [];
|
|
||||||
this.operatorIdOptions = options["operator"] || [];
|
|
||||||
this.operatorAssisIdOptions = options["operator_assis"] || [];
|
|
||||||
});
|
|
||||||
this.getDicts("cus_pay_type").then((response) => {
|
this.getDicts("cus_pay_type").then((response) => {
|
||||||
this.payTypeIdOptions = response.data;
|
this.payTypeIdOptions = response.data;
|
||||||
});
|
});
|
||||||
this.getDicts("cus_account").then((response) => {
|
this.getDicts("cus_account").then((response) => {
|
||||||
this.accountIdOptions = response.data;
|
this.accountIdOptions = response.data;
|
||||||
console.log(response.data);
|
// console.log(response.data);
|
||||||
this.accountIdOptions.splice(0, 0, {
|
this.accountIdOptions.splice(0, 0, {
|
||||||
dictLabel: "无",
|
dictLabel: "无",
|
||||||
dictValue: "0",
|
dictValue: "0",
|
||||||
@ -484,6 +465,26 @@ export default {
|
|||||||
this.orderTypeOptions = response.data;
|
this.orderTypeOptions = response.data;
|
||||||
});*/
|
});*/
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
// 售前字典
|
||||||
|
"preSaleIdOptions",
|
||||||
|
// 售后字典
|
||||||
|
"afterSaleIdOptions",
|
||||||
|
// 主营养师字典
|
||||||
|
"nutritionistIdOptions",
|
||||||
|
// 助理营养师字典
|
||||||
|
"nutriAssisIdOptions",
|
||||||
|
// 策划字典
|
||||||
|
"plannerIdOptions",
|
||||||
|
// 策划助理字典
|
||||||
|
"plannerAssisIdOptions",
|
||||||
|
// 运营字典
|
||||||
|
"operatorIdOptions",
|
||||||
|
// 运营助理字典
|
||||||
|
"operatorAssisIdOptions",
|
||||||
|
]),
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showDialog(data, callback) {
|
showDialog(data, callback) {
|
||||||
// this.data = data;
|
// this.data = data;
|
||||||
@ -554,7 +555,9 @@ export default {
|
|||||||
(opt) => parseInt(opt.dictValue) === accountId
|
(opt) => parseInt(opt.dictValue) === accountId
|
||||||
);
|
);
|
||||||
|
|
||||||
const defaultOrderRate = this.orderRateOptions.find((opt) => opt.remark === "default");
|
const defaultOrderRate = this.orderRateOptions.find(
|
||||||
|
(opt) => opt.remark === "default"
|
||||||
|
);
|
||||||
|
|
||||||
const [
|
const [
|
||||||
plannerId,
|
plannerId,
|
||||||
@ -590,7 +593,9 @@ export default {
|
|||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
nutritionistId: null,
|
nutritionistId: null,
|
||||||
nutritionistIdList: defaultNutritionist ? [parseInt(defaultNutritionist.dictValue)] : null,
|
nutritionistIdList: defaultNutritionist
|
||||||
|
? [parseInt(defaultNutritionist.dictValue)]
|
||||||
|
: null,
|
||||||
nutritionistRate: defaultOrderRate ? defaultOrderRate.dictValue : null,
|
nutritionistRate: defaultOrderRate ? defaultOrderRate.dictValue : null,
|
||||||
remark: null,
|
remark: null,
|
||||||
nutriAssisId: defaultNutriAssis
|
nutriAssisId: defaultNutriAssis
|
||||||
@ -649,7 +654,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleOrderTypeChange() {
|
handleOrderTypeChange() {
|
||||||
console.log(this.form.orderType);
|
console.log(this.form.orderType);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 监听收款账号的变化
|
// 监听收款账号的变化
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
:title="title"
|
:title="title"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
:visible.sync="visible"
|
:visible.sync="visible"
|
||||||
|
:wrapperClosable="false"
|
||||||
@closed="handleOnClosed"
|
@closed="handleOnClosed"
|
||||||
size="40%"
|
size="40%"
|
||||||
>
|
>
|
||||||
|
@ -235,8 +235,9 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { addOrder, getOptions, updateOrder } from "@/api/custom/order";
|
import { addOrder, updateOrder } from "@/api/custom/order";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OrderEdit",
|
name: "OrderEdit",
|
||||||
@ -354,16 +355,6 @@ export default {
|
|||||||
},
|
},
|
||||||
// 收款方式字典
|
// 收款方式字典
|
||||||
payTypeIdOptions: [],
|
payTypeIdOptions: [],
|
||||||
// 售前字典
|
|
||||||
preSaleIdOptions: [],
|
|
||||||
// 售后字典
|
|
||||||
afterSaleIdOptions: [],
|
|
||||||
// 主营养师字典
|
|
||||||
nutritionistIdOptions: [],
|
|
||||||
// 助理营养师字典
|
|
||||||
nutriAssisIdOptions: [],
|
|
||||||
// 策划字典
|
|
||||||
plannerIdOptions: [],
|
|
||||||
// 账号
|
// 账号
|
||||||
accountIdOptions: [],
|
accountIdOptions: [],
|
||||||
// 服务时长
|
// 服务时长
|
||||||
@ -372,42 +363,13 @@ export default {
|
|||||||
giveTimeIdOption: [],
|
giveTimeIdOption: [],
|
||||||
//调理项目
|
//调理项目
|
||||||
conditioningProjectIdOption: [],
|
conditioningProjectIdOption: [],
|
||||||
// 策划助理字典
|
|
||||||
plannerAssisIdOptions: [],
|
|
||||||
// 运营字典
|
|
||||||
operatorIdOptions: [],
|
|
||||||
// 审核状态
|
// 审核状态
|
||||||
reviewStatusOptions: [],
|
reviewStatusOptions: [],
|
||||||
//
|
|
||||||
operatorAssisIdOptions: [],
|
|
||||||
//下拉列表对应关系(用于选择收款账号自动选择策划、策划助理、运营、运营助理)
|
//下拉列表对应关系(用于选择收款账号自动选择策划、策划助理、运营、运营助理)
|
||||||
orderDropdownCorrespondingOptions: [],
|
orderDropdownCorrespondingOptions: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
getOptions().then((res) => {
|
|
||||||
const options = res.data.reduce((opts, cur) => {
|
|
||||||
if (!opts[cur.postCode]) {
|
|
||||||
opts[cur.postCode] = [
|
|
||||||
{ dictValue: 0, dictLabel: "无", remark: null },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
opts[cur.postCode].push({
|
|
||||||
dictValue: cur.userId,
|
|
||||||
dictLabel: cur.userName,
|
|
||||||
remark: cur.remark,
|
|
||||||
});
|
|
||||||
return opts;
|
|
||||||
}, {});
|
|
||||||
this.preSaleIdOptions = options["pre_sale"] || [];
|
|
||||||
this.afterSaleIdOptions = options["after_sale"] || [];
|
|
||||||
this.nutritionistIdOptions = options["nutri"] || [];
|
|
||||||
this.nutriAssisIdOptions = options["nutri_assis"] || [];
|
|
||||||
this.plannerIdOptions = options["planner"] || [];
|
|
||||||
this.plannerAssisIdOptions = options["planner_assis"] || [];
|
|
||||||
this.operatorIdOptions = options["operator"] || [];
|
|
||||||
this.operatorAssisIdOptions = options["operator_assis"] || [];
|
|
||||||
});
|
|
||||||
this.getDicts("cus_pay_type").then((response) => {
|
this.getDicts("cus_pay_type").then((response) => {
|
||||||
this.payTypeIdOptions = response.data;
|
this.payTypeIdOptions = response.data;
|
||||||
});
|
});
|
||||||
@ -435,6 +397,26 @@ export default {
|
|||||||
this.orderDropdownCorrespondingOptions = response.data;
|
this.orderDropdownCorrespondingOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
// 售前字典
|
||||||
|
"preSaleIdOptions",
|
||||||
|
// 售后字典
|
||||||
|
"afterSaleIdOptions",
|
||||||
|
// 主营养师字典
|
||||||
|
"nutritionistIdOptions",
|
||||||
|
// 助理营养师字典
|
||||||
|
"nutriAssisIdOptions",
|
||||||
|
// 策划字典
|
||||||
|
"plannerIdOptions",
|
||||||
|
// 策划助理字典
|
||||||
|
"plannerAssisIdOptions",
|
||||||
|
// 运营字典
|
||||||
|
"operatorIdOptions",
|
||||||
|
// 运营助理字典
|
||||||
|
"operatorAssisIdOptions",
|
||||||
|
]),
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showDialog(data, callback) {
|
showDialog(data, callback) {
|
||||||
// this.data = data;
|
// this.data = data;
|
||||||
|
@ -472,7 +472,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
.margin-top-20{
|
.margin-top-20{
|
||||||
margin-top:20px;
|
margin-top:20px;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
.margin-top-20{
|
.margin-top-20{
|
||||||
margin-top:20px;
|
margin-top:20px;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
.margin-top-20{
|
.margin-top-20{
|
||||||
margin-top:20px;
|
margin-top:20px;
|
||||||
}
|
}
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="main">
|
|
||||||
<div class="aspect">指标</div>
|
|
||||||
<div class="recipes">
|
|
||||||
<el-table :data="mData" border :span-method="spanMethod" size="mini">
|
|
||||||
<el-table-column :label="`${name}第${num}天`"></el-table-column>
|
|
||||||
<el-table-column label="菜品" prop="name"></el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "RecipesCom",
|
|
||||||
props: {
|
|
||||||
data: {
|
|
||||||
type: Array,
|
|
||||||
default: [],
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
default: "",
|
|
||||||
},
|
|
||||||
num: {
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {},
|
|
||||||
mounted() {
|
|
||||||
// console.log(this.data);
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
mData() {
|
|
||||||
if (!this.data.dishes) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const mData = this.data.dishes.reduce((arr, cur) => {
|
|
||||||
if (cur.id > 0) {
|
|
||||||
cur.igdList.forEach((igd) => {
|
|
||||||
if (igd.id > 0) {
|
|
||||||
const tarDetail = cur.detail.find((det) => det.id == igd.id);
|
|
||||||
arr.push({
|
|
||||||
id: cur.id,
|
|
||||||
name: cur.name,
|
|
||||||
type: cur.type,
|
|
||||||
isMain: cur.isMain,
|
|
||||||
methods: cur.methods,
|
|
||||||
igdId: igd.id,
|
|
||||||
igdName: igd.name,
|
|
||||||
proteinRatio: igd.proteinRatio,
|
|
||||||
fatRatio: igd.fatRatio,
|
|
||||||
carbonRatio: igd.carbonRatio,
|
|
||||||
rec: igd.rec,
|
|
||||||
notRec: igd.notRec,
|
|
||||||
weight: tarDetail ? tarDetail.weight : igd.weight,
|
|
||||||
cusWeight: tarDetail ? tarDetail.cus_weight : igd.cusWeight,
|
|
||||||
cusUnit: tarDetail ? tarDetail.cus_unit : igd.cusUnit,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}, []);
|
|
||||||
// console.log(mData);
|
|
||||||
return mData;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
spanMethod({ row, column, rowIndex, columnIndex }) {},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<style rel="stylesheet/scss" lang="scss">
|
|
||||||
.main {
|
|
||||||
.aspect {
|
|
||||||
}
|
|
||||||
|
|
||||||
.recipies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="classname">
|
<div :class="classname">
|
||||||
<span class="title">{{ title }}:</span>
|
<span class="info_title">{{ title }}:</span>
|
||||||
<span v-if="newLine">
|
<span v-if="newLine">
|
||||||
<div v-for="value in mValue" :key="value">{{ value }}</div>
|
<div v-for="value in mValue" :key="value">{{ value }}</div>
|
||||||
</span>
|
</span>
|
||||||
<span v-else class="value">{{ mValue }}</span>
|
<span v-else class="info_value">{{ mValue }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -32,19 +32,19 @@ export default {
|
|||||||
props: ["title", "value", "extraclass"],
|
props: ["title", "value", "extraclass"],
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss">
|
<style lang="scss" >
|
||||||
.text_info_wrapper {
|
.text_info_wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-right: 24px;
|
margin-right: 24px;
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
.title {
|
.info_title {
|
||||||
color: #8c8c8c;
|
color: #8c8c8c;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.info_value {
|
||||||
/* color: #696969; */
|
/* color: #696969; */
|
||||||
flex: 1 1 0;
|
flex: 1 1 0;
|
||||||
}
|
}
|
@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
<hamburger
|
||||||
|
id="hamburger-container"
|
||||||
|
:is-active="sidebar.opened"
|
||||||
|
class="hamburger-container"
|
||||||
|
@toggleClick="toggleSideBar"
|
||||||
|
/>
|
||||||
|
|
||||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
|
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
|
||||||
|
|
||||||
@ -21,12 +26,14 @@
|
|||||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
|
<el-dropdown
|
||||||
|
class="avatar-container right-menu-item hover-effect"
|
||||||
|
trigger="click"
|
||||||
|
>
|
||||||
<div class="avatar-wrapper">
|
<div class="avatar-wrapper">
|
||||||
<img :src="avatar" class="user-avatar">
|
<img :src="avatar" class="user-avatar" />
|
||||||
<i class="el-icon-caret-bottom" />
|
<i class="el-icon-caret-bottom" />
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
@ -46,14 +53,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters, mapActions } from "vuex";
|
||||||
import Breadcrumb from '@/components/Breadcrumb'
|
import Breadcrumb from "@/components/Breadcrumb";
|
||||||
import Hamburger from '@/components/Hamburger'
|
import Hamburger from "@/components/Hamburger";
|
||||||
import Screenfull from '@/components/Screenfull'
|
import Screenfull from "@/components/Screenfull";
|
||||||
import SizeSelect from '@/components/SizeSelect'
|
import SizeSelect from "@/components/SizeSelect";
|
||||||
import Search from '@/components/HeaderSearch'
|
import Search from "@/components/HeaderSearch";
|
||||||
import RuoYiGit from '@/components/RuoYi/Git'
|
import RuoYiGit from "@/components/RuoYi/Git";
|
||||||
import RuoYiDoc from '@/components/RuoYi/Doc'
|
import RuoYiDoc from "@/components/RuoYi/Doc";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -63,43 +70,43 @@ export default {
|
|||||||
SizeSelect,
|
SizeSelect,
|
||||||
Search,
|
Search,
|
||||||
RuoYiGit,
|
RuoYiGit,
|
||||||
RuoYiDoc
|
RuoYiDoc,
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.init();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters(["sidebar", "avatar", "device"]),
|
||||||
'sidebar',
|
|
||||||
'avatar',
|
|
||||||
'device'
|
|
||||||
]),
|
|
||||||
setting: {
|
setting: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.settings.showSettings
|
return this.$store.state.settings.showSettings;
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
this.$store.dispatch('settings/changeSetting', {
|
this.$store.dispatch("settings/changeSetting", {
|
||||||
key: 'showSettings',
|
key: "showSettings",
|
||||||
value: val
|
value: val,
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(["init"]),
|
||||||
toggleSideBar() {
|
toggleSideBar() {
|
||||||
this.$store.dispatch('app/toggleSideBar')
|
this.$store.dispatch("app/toggleSideBar");
|
||||||
},
|
},
|
||||||
async logout() {
|
async logout() {
|
||||||
this.$confirm('确定注销并退出系统吗?', '提示', {
|
this.$confirm("确定注销并退出系统吗?", "提示", {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: "取消",
|
||||||
type: 'warning'
|
type: "warning",
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$store.dispatch('LogOut').then(() => {
|
this.$store.dispatch("LogOut").then(() => {
|
||||||
location.href = '/index';
|
location.href = "/index";
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -108,18 +115,18 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
box-shadow: 0 1px 4px rgba(0,21,41,.08);
|
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
||||||
|
|
||||||
.hamburger-container {
|
.hamburger-container {
|
||||||
line-height: 46px;
|
line-height: 46px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
float: left;
|
float: left;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background .3s;
|
transition: background 0.3s;
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: rgba(0, 0, 0, .025)
|
background: rgba(0, 0, 0, 0.025);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,10 +158,10 @@ export default {
|
|||||||
|
|
||||||
&.hover-effect {
|
&.hover-effect {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background .3s;
|
transition: background 0.3s;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: rgba(0, 0, 0, .025)
|
background: rgba(0, 0, 0, 0.025);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ export const constantRoutes = [
|
|||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "build/:cusId/:planId/:recipesId",
|
path: "build",
|
||||||
component: resolve =>
|
component: resolve =>
|
||||||
require(["@/views/custom/recipesBuild"], resolve),
|
require(["@/views/custom/recipesBuild"], resolve),
|
||||||
name: "RecipiesBuild",
|
name: "RecipiesBuild",
|
||||||
|
7
stdiet-ui/src/store/actions.js
Normal file
7
stdiet-ui/src/store/actions.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
const actions = {
|
||||||
|
async init({ dispatch }, payload) {
|
||||||
|
dispatch("global/init", payload);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default actions;
|
@ -11,6 +11,15 @@ const getters = {
|
|||||||
roles: state => state.user.roles,
|
roles: state => state.user.roles,
|
||||||
permissions: state => state.user.permissions,
|
permissions: state => state.user.permissions,
|
||||||
userId: state => state.user.userId,
|
userId: state => state.user.userId,
|
||||||
permission_routes: state => state.permission.routes
|
permission_routes: state => state.permission.routes,
|
||||||
}
|
//
|
||||||
export default getters
|
nutritionistIdOptions: state => state.global.nutritionistIdOptions,
|
||||||
|
nutriAssisIdOptions: state => state.global.nutriAssisIdOptions,
|
||||||
|
preSaleIdOptions: state => state.global.preSaleIdOptions,
|
||||||
|
afterSaleIdOptions: state => state.global.afterSaleIdOptions,
|
||||||
|
plannerIdOptions: state => state.global.plannerIdOptions,
|
||||||
|
plannerAssisIdOptions: state => state.global.plannerAssisIdOptions,
|
||||||
|
operatorIdOptions: state => state.global.operatorIdOptions,
|
||||||
|
operatorAssisIdOptions: state => state.global.operatorAssisIdOptions
|
||||||
|
};
|
||||||
|
export default getters;
|
||||||
|
@ -6,8 +6,10 @@ import tagsView from "./modules/tagsView";
|
|||||||
import permission from "./modules/permission";
|
import permission from "./modules/permission";
|
||||||
import settings from "./modules/settings";
|
import settings from "./modules/settings";
|
||||||
import recipes from "./modules/recipes";
|
import recipes from "./modules/recipes";
|
||||||
|
import global from "./modules/global";
|
||||||
|
|
||||||
import getters from "./getters";
|
import getters from "./getters";
|
||||||
|
import actions from "./actions";
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
|
|
||||||
@ -18,9 +20,11 @@ const store = new Vuex.Store({
|
|||||||
tagsView,
|
tagsView,
|
||||||
permission,
|
permission,
|
||||||
settings,
|
settings,
|
||||||
recipes
|
recipes,
|
||||||
|
global
|
||||||
},
|
},
|
||||||
getters
|
getters,
|
||||||
|
actions
|
||||||
});
|
});
|
||||||
|
|
||||||
export default store;
|
export default store;
|
||||||
|
60
stdiet-ui/src/store/modules/global.js
Normal file
60
stdiet-ui/src/store/modules/global.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import { getOptions } from "@/api/custom/global";
|
||||||
|
|
||||||
|
const oriState = {
|
||||||
|
nutritionistIdOptions: [],
|
||||||
|
nutriAssisIdOptions: [],
|
||||||
|
preSaleIdOptions: [],
|
||||||
|
afterSaleIdOptions: [],
|
||||||
|
plannerIdOptions: [],
|
||||||
|
plannerAssisIdOptions: [],
|
||||||
|
operatorIdOptions: [],
|
||||||
|
operatorAssisIdOptions: []
|
||||||
|
};
|
||||||
|
|
||||||
|
const mutations = {
|
||||||
|
save(state, payload) {
|
||||||
|
Object.keys(payload).forEach(key => {
|
||||||
|
state[key] = payload[key];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
clean(state) {
|
||||||
|
Object.keys(oriState).forEach(key => {
|
||||||
|
state[key] = oriState[key];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const actions = {
|
||||||
|
async init({ commit }, payload) {
|
||||||
|
const { data: optionsData } = await getOptions();
|
||||||
|
const options = optionsData.reduce((opts, cur) => {
|
||||||
|
if (!opts[cur.postCode]) {
|
||||||
|
opts[cur.postCode] = [{ dictValue: 0, dictLabel: "无", remark: null }];
|
||||||
|
}
|
||||||
|
opts[cur.postCode].push({
|
||||||
|
dictValue: cur.userId,
|
||||||
|
dictLabel: cur.userName,
|
||||||
|
remark: cur.remark
|
||||||
|
});
|
||||||
|
return opts;
|
||||||
|
}, {});
|
||||||
|
commit("save", {
|
||||||
|
nutritionistIdOptions: options["nutri"] || [],
|
||||||
|
nutriAssisIdOptions: options["nutri_assis"] || [],
|
||||||
|
preSaleIdOptions: options["pre_sale"] || [],
|
||||||
|
afterSaleIdOptions: options["after_sale"] || [],
|
||||||
|
plannerIdOptions: options["planner"] || [],
|
||||||
|
plannerAssisIdOptions: options["planner_assis"] || [],
|
||||||
|
operatorIdOptions: options["operator"] || [],
|
||||||
|
operatorAssisIdOptions: options["operator_assis"] || []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const getters = {};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
state: Object.assign({}, oriState),
|
||||||
|
mutations,
|
||||||
|
actions,
|
||||||
|
getters
|
||||||
|
};
|
@ -1,22 +1,68 @@
|
|||||||
import { getOrder } from "@/api/custom/order";
|
|
||||||
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
||||||
import { dealHealthy } from "@/utils/healthyData";
|
import { dealHealthy } from "@/utils/healthyData";
|
||||||
import { getRecipesPlan } from "@/api/custom/recipesPlan";
|
import {
|
||||||
import { getRecipes } from "@/api/custom/recipes";
|
getRecipesApi,
|
||||||
|
updateDishesDetailApi,
|
||||||
|
addDishesApi,
|
||||||
|
deleteDishesApi,
|
||||||
|
addRecipesApi
|
||||||
|
} from "@/api/custom/recipes";
|
||||||
|
import { getDicts } from "@/api/system/dict/data";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
const oriState = {
|
const oriState = {
|
||||||
|
cusId: undefined,
|
||||||
|
planId: undefined,
|
||||||
|
recipesId: undefined,
|
||||||
healthyData: {},
|
healthyData: {},
|
||||||
|
healthDataLoading: false,
|
||||||
healthyDataType: 0,
|
healthyDataType: 0,
|
||||||
recipesData: []
|
recipesData: [],
|
||||||
|
recipesDataLoading: false,
|
||||||
|
cusUnitOptions: [],
|
||||||
|
cusWeightOptions: [],
|
||||||
|
dishesTypeOptions: [],
|
||||||
|
typeOptions: [],
|
||||||
|
currentDay: -1,
|
||||||
|
startDate: "",
|
||||||
|
endDate: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
setHealtyData(state, payload) {
|
updateRecipesDishesDetail(state, payload) {
|
||||||
state.healthyDataType = payload.healthyDataType;
|
const tarDishes = state.recipesData[payload.num].dishes.find(
|
||||||
state.healthyData = payload.healthyData;
|
obj => obj.dishesId === payload.dishesId
|
||||||
|
);
|
||||||
|
if (tarDishes) {
|
||||||
|
const tarIgd = tarDishes.igdList.find(obj => obj.id === payload.igdId);
|
||||||
|
if (tarIgd) {
|
||||||
|
Object.keys(payload).forEach(key => {
|
||||||
|
tarIgd[key] = payload[key];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setRecipesData(state, payload) {
|
addRecipesDishes(state, payload) {
|
||||||
state.recipesData = payload.recipesData;
|
state.recipesData[payload.num].dishes.push(payload.data);
|
||||||
|
},
|
||||||
|
setCurrentDay(state, payload) {
|
||||||
|
state.currentDay =
|
||||||
|
payload.currentDay === state.currentDay ? -1 : payload.currentDay;
|
||||||
|
},
|
||||||
|
deleteSomeDayDishes(state, payload) {
|
||||||
|
// console.log(payload);
|
||||||
|
state.recipesData[payload.num].dishes = state.recipesData[
|
||||||
|
payload.num
|
||||||
|
].dishes.filter(obj => obj.id !== payload.id);
|
||||||
|
},
|
||||||
|
updateStateData(state, payload) {
|
||||||
|
Object.keys(payload).forEach(key => {
|
||||||
|
state[key] = payload[key];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setDate(state, payload) {
|
||||||
|
state.startDate = payload.startDate;
|
||||||
|
state.endDate = payload.endDate;
|
||||||
},
|
},
|
||||||
clean(state) {
|
clean(state) {
|
||||||
// console.log("clean");
|
// console.log("clean");
|
||||||
@ -27,40 +73,281 @@ const mutations = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
async init({ commit }, payload) {
|
async init({ commit, dispatch }, payload) {
|
||||||
const orderResult = await getOrder(payload.cusId);
|
// console.log(payload);
|
||||||
if (!orderResult.data.cusId) {
|
//
|
||||||
throw new Error("未找到用户id");
|
commit("updateStateData", payload);
|
||||||
}
|
//
|
||||||
|
getDicts("cus_cus_unit").then(response => {
|
||||||
|
commit("updateStateData", { cusUnitOptions: response.data });
|
||||||
|
});
|
||||||
|
getDicts("cus_cus_weight").then(response => {
|
||||||
|
commit("updateStateData", { cusWeightOptions: response.data });
|
||||||
|
});
|
||||||
|
getDicts("cus_dishes_type").then(response => {
|
||||||
|
commit("updateStateData", { typeOptions: response.data });
|
||||||
|
});
|
||||||
|
getDicts("cus_dishes_type").then(response => {
|
||||||
|
commit("updateStateData", { dishesTypeOptions: response.data });
|
||||||
|
});
|
||||||
|
|
||||||
// 健康数据
|
// 健康数据
|
||||||
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
|
if (payload.cusId) {
|
||||||
orderResult.data.cusId
|
dispatch("getHealthyData", payload);
|
||||||
);
|
|
||||||
if (healthyDataResult.code === 200) {
|
|
||||||
commit("setHealtyData", {
|
|
||||||
healthyDataType: healthyDataResult.data.type,
|
|
||||||
healthyData: dealHealthy(healthyDataResult.data.customerHealthy)
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
throw new Error(healthyDataResult.msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 食谱数据
|
// 食谱数据
|
||||||
if (payload.recipesId) {
|
if (payload.recipesId) {
|
||||||
const recipesDataResult = await getRecipes(payload.recipesId);
|
dispatch("getRecipesInfo", payload);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getHealthyData({ commit }, payload) {
|
||||||
|
commit("updateStateData", { healthDataLoading: true });
|
||||||
|
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
|
||||||
|
payload.cusId
|
||||||
|
);
|
||||||
|
let healthyData = undefined,
|
||||||
|
healthyDataType = 0;
|
||||||
|
if (healthyDataResult.code === 200) {
|
||||||
|
if (!healthyDataResult.data.customerHealthy) {
|
||||||
|
throw new Error("客户还没填写健康评估表");
|
||||||
|
}
|
||||||
|
healthyDataType = healthyDataResult.data.type;
|
||||||
|
healthyData = dealHealthy(healthyDataResult.data.customerHealthy);
|
||||||
|
} else {
|
||||||
|
throw new Error(healthyDataResult.msg);
|
||||||
|
}
|
||||||
|
commit("updateStateData", {
|
||||||
|
healthDataLoading: false,
|
||||||
|
healthyDataType,
|
||||||
|
healthyData
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async getRecipesInfo({ commit }, payload) {
|
||||||
|
commit("updateStateData", {
|
||||||
|
recipesDataLoading: true
|
||||||
|
});
|
||||||
|
const recipesDataResult = await getRecipesApi(payload.recipesId);
|
||||||
|
let recipesData = undefined;
|
||||||
if (recipesDataResult.code === 200) {
|
if (recipesDataResult.code === 200) {
|
||||||
commit("setRecipesData", {
|
recipesData = recipesDataResult.data.map(dayData => {
|
||||||
recipesData: recipesDataResult.data
|
return {
|
||||||
|
id: dayData.id,
|
||||||
|
numDay: dayData.numDay,
|
||||||
|
dishes: dayData.dishes.reduce((arr, cur) => {
|
||||||
|
if (
|
||||||
|
cur.dishesId > -1 &&
|
||||||
|
cur.name &&
|
||||||
|
cur.igdList.length > 0 &&
|
||||||
|
cur.type !== "0"
|
||||||
|
) {
|
||||||
|
arr.push({
|
||||||
|
id: cur.id,
|
||||||
|
dishesId: cur.dishesId,
|
||||||
|
name: cur.name,
|
||||||
|
menuId: cur.menuId,
|
||||||
|
methods: cur.methods,
|
||||||
|
type: cur.type,
|
||||||
|
isMain: cur.isMain,
|
||||||
|
igdList: cur.igdList.reduce((igdArr, igdData) => {
|
||||||
|
if (igdData.id > 0) {
|
||||||
|
const tarDetail = cur.detail.find(
|
||||||
|
obj => obj.id === igdData.id
|
||||||
|
);
|
||||||
|
igdArr.push({
|
||||||
|
id: igdData.id,
|
||||||
|
name: igdData.name,
|
||||||
|
carbonRatio: igdData.carbonRatio,
|
||||||
|
fatRatio: igdData.fatRatio,
|
||||||
|
proteinRatio: igdData.proteinRatio,
|
||||||
|
cusUnit: tarDetail ? tarDetail.cus_unit : igdData.cusUnit,
|
||||||
|
cusWeight: tarDetail
|
||||||
|
? parseFloat(tarDetail.cus_weight)
|
||||||
|
: igdData.cusWeight,
|
||||||
|
weight: tarDetail
|
||||||
|
? parseFloat(tarDetail.weight)
|
||||||
|
: igdData.weight,
|
||||||
|
notRec: igdData.notRec,
|
||||||
|
rec: igdData.rec,
|
||||||
|
type: igdData.type
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return igdArr;
|
||||||
|
}, [])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, [])
|
||||||
|
};
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new Error(recipesDataResult.msg);
|
throw new Error(recipesDataResult.msg);
|
||||||
}
|
}
|
||||||
|
commit("updateStateData", { recipesDataLoading: false, recipesData });
|
||||||
|
},
|
||||||
|
async saveRecipes({ commit, dispatch, state }, payload) {
|
||||||
|
const { recipesData, cusId, planId } = state;
|
||||||
|
const params = {
|
||||||
|
cusId,
|
||||||
|
planId,
|
||||||
|
menus: recipesData.map((menu, idx) => ({
|
||||||
|
date: dayjs(state.startDate)
|
||||||
|
.add(idx, "day")
|
||||||
|
.format("YYYY-MM-DD"),
|
||||||
|
cusId,
|
||||||
|
dishes: menu.dishes.map(dObj => ({
|
||||||
|
dishesId: dObj.dishesId,
|
||||||
|
type: dObj.type,
|
||||||
|
detail: dObj.igdList.map(igd => ({
|
||||||
|
id: igd.id,
|
||||||
|
weight: igd.weight,
|
||||||
|
cus_unit: igd.cusUnit,
|
||||||
|
cus_weight: igd.cusWeight
|
||||||
|
}))
|
||||||
|
}))
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
const result = await addRecipesApi(params);
|
||||||
|
if (result.code === 200) {
|
||||||
|
const recipesId = result.data;
|
||||||
|
commit("updateStateData", { recipesId });
|
||||||
|
dispatch("getRecipesInfo", { recipesId });
|
||||||
|
}
|
||||||
|
// console.log(params);
|
||||||
|
},
|
||||||
|
async addDishes({ commit, state }, payload) {
|
||||||
|
if (state.recipesId) {
|
||||||
|
const tarRecipesObj = state.recipesData[payload.num];
|
||||||
|
if (tarRecipesObj && payload.data) {
|
||||||
|
const { dishesId, type, igdList } = payload.data;
|
||||||
|
const params = {
|
||||||
|
type,
|
||||||
|
dishesId,
|
||||||
|
menuId: tarRecipesObj.id,
|
||||||
|
detail: igdList.map(igd => ({
|
||||||
|
id: igd.id,
|
||||||
|
weight: igd.weight,
|
||||||
|
cus_unit: igd.cusUnit,
|
||||||
|
cus_weight: igd.cusWeight
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
const result = await addDishesApi(params);
|
||||||
|
if (result.code === 200) {
|
||||||
|
payload.menuId = tarRecipesObj.id;
|
||||||
|
// 更新id
|
||||||
|
payload.data.id = result.data;
|
||||||
|
commit("addRecipesDishes", payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// console.log(result);
|
||||||
|
} else {
|
||||||
|
commit("addRecipesDishes", payload);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async updateDishes({ commit, state }, payload) {
|
||||||
|
if (state.recipesId) {
|
||||||
|
const tarDishes = state.recipesData[payload.num].dishes.find(
|
||||||
|
obj => obj.dishesId === payload.dishesId
|
||||||
|
);
|
||||||
|
if (tarDishes) {
|
||||||
|
const mTarDishes = JSON.parse(JSON.stringify(tarDishes));
|
||||||
|
const tarIgd = mTarDishes.igdList.find(obj => obj.id === payload.igdId);
|
||||||
|
if (tarIgd) {
|
||||||
|
payload.weight && (tarIgd.weight = payload.weight);
|
||||||
|
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
|
||||||
|
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
id: mTarDishes.id,
|
||||||
|
detail: mTarDishes.igdList.map(igd => ({
|
||||||
|
id: igd.id,
|
||||||
|
weight: igd.weight,
|
||||||
|
cus_unit: igd.cusUnit,
|
||||||
|
cus_weight: igd.cusWeight
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
const result = await updateDishesDetailApi(params);
|
||||||
|
if (result.code === 200) {
|
||||||
|
commit("updateRecipesDishesDetail", payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
commit("updateRecipesDishesDetail", payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async deleteDishes({ commit, state }, payload) {
|
||||||
|
if (state.recipesId) {
|
||||||
|
const tarDishes = state.recipesData[payload.num].dishes.find(
|
||||||
|
obj => obj.id === payload.id
|
||||||
|
);
|
||||||
|
if (tarDishes) {
|
||||||
|
const result = await deleteDishesApi(tarDishes.id);
|
||||||
|
if (result.code === 200) {
|
||||||
|
commit("deleteSomeDayDishes", payload);
|
||||||
|
}
|
||||||
|
// console.log(params);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
commit("deleteSomeDayDishes", payload);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async deleteMenu({ commit }, payload) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getters = {};
|
const getters = {
|
||||||
|
analyseData: state => {
|
||||||
|
if (!state.recipesData.length) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const datas =
|
||||||
|
state.currentDay > -1
|
||||||
|
? [state.recipesData[state.currentDay]]
|
||||||
|
: state.recipesData;
|
||||||
|
|
||||||
|
const nutriData = datas.map(data =>
|
||||||
|
data.dishes.reduce(
|
||||||
|
(obj, cur) => {
|
||||||
|
cur.igdList.forEach(igd => {
|
||||||
|
obj.pWeight += (igd.weight / 100) * igd.proteinRatio;
|
||||||
|
obj.pHeat = obj.pWeight * 4;
|
||||||
|
obj.fWeight += (igd.weight / 100) * igd.fatRatio;
|
||||||
|
obj.fHeat = obj.fWeight * 9;
|
||||||
|
obj.cWeight += (igd.weight / 100) * igd.carbonRatio;
|
||||||
|
obj.cHeat = obj.cWeight * 4;
|
||||||
|
});
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: `第${data.numDay}天`,
|
||||||
|
pWeight: 0,
|
||||||
|
fWeight: 0,
|
||||||
|
cWeight: 0,
|
||||||
|
pHeat: 0,
|
||||||
|
fHeat: 0,
|
||||||
|
cHeat: 0
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
// console.log(nutriData);
|
||||||
|
return nutriData;
|
||||||
|
},
|
||||||
|
cusUnitDict: state =>
|
||||||
|
state.cusUnitOptions.reduce((obj, cur) => {
|
||||||
|
obj[cur.dictValue] = cur.dictLabel;
|
||||||
|
return obj;
|
||||||
|
}, {}),
|
||||||
|
cusWeightDict: state =>
|
||||||
|
state.cusWeightOptions.reduce((obj, cur) => {
|
||||||
|
obj[cur.dictValue] = cur.dictLabel;
|
||||||
|
return obj;
|
||||||
|
}, {}),
|
||||||
|
typeDict: state =>
|
||||||
|
state.typeOptions.reduce((obj, cur) => {
|
||||||
|
obj[cur.dictValue] = cur.dictLabel;
|
||||||
|
return obj;
|
||||||
|
}, {})
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
|
257
stdiet-ui/src/utils/echarts/myShine.js
Normal file
257
stdiet-ui/src/utils/echarts/myShine.js
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
(function(root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define(['exports', 'echarts'], factory);
|
||||||
|
} else if (
|
||||||
|
typeof exports === 'object' &&
|
||||||
|
typeof exports.nodeName !== 'string'
|
||||||
|
) {
|
||||||
|
// CommonJS
|
||||||
|
factory(exports, require('echarts'));
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
factory({}, root.echarts);
|
||||||
|
}
|
||||||
|
})(this, function(exports, echarts) {
|
||||||
|
var log = function(msg) {
|
||||||
|
if (typeof console !== 'undefined') {
|
||||||
|
console && console.error && console.error(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!echarts) {
|
||||||
|
log('ECharts is not Loaded');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var colorPalette = [
|
||||||
|
'#c12e34',
|
||||||
|
'#e6b600',
|
||||||
|
'#0098d9',
|
||||||
|
'#2b821d',
|
||||||
|
'#005eaa',
|
||||||
|
'#339ca8',
|
||||||
|
'#cda819',
|
||||||
|
'#32a487'
|
||||||
|
];
|
||||||
|
|
||||||
|
var theme = {
|
||||||
|
color: colorPalette,
|
||||||
|
|
||||||
|
title: {
|
||||||
|
textStyle: {
|
||||||
|
fontWeight: 'normal',
|
||||||
|
fontSize: 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
visualMap: {
|
||||||
|
color: ['#1790cf', '#a2d4e6']
|
||||||
|
},
|
||||||
|
|
||||||
|
toolbox: {
|
||||||
|
iconStyle: {
|
||||||
|
normal: {
|
||||||
|
borderColor: '#06467c'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
tooltip: {
|
||||||
|
textStyle: {
|
||||||
|
color: '#262626',
|
||||||
|
fontSize: 12
|
||||||
|
},
|
||||||
|
backgroundColor: 'rgba(255,255,255,0.9)',
|
||||||
|
borderWidth: 1,
|
||||||
|
padding: 10,
|
||||||
|
borderColor: '#ccc',
|
||||||
|
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);',
|
||||||
|
},
|
||||||
|
|
||||||
|
categoryAxis: {
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#ebebeb',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
axisTick: {
|
||||||
|
show: false,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#ebebeb',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
axisLabel: {
|
||||||
|
show: true,
|
||||||
|
textStyle: {
|
||||||
|
color: '#262626',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
show: false,
|
||||||
|
lineStyle: {
|
||||||
|
color: ['#ccc'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
splitArea: {
|
||||||
|
show: false,
|
||||||
|
areaStyle: {
|
||||||
|
color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
valueAxis: {
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#ebebeb',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
axisTick: {
|
||||||
|
show: false,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#ebebeb',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
axisLabel: {
|
||||||
|
show: true,
|
||||||
|
textStyle: {
|
||||||
|
color: '#262626',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
show: false,
|
||||||
|
lineStyle: {
|
||||||
|
color: ['#ccc'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
splitArea: {
|
||||||
|
show: false,
|
||||||
|
areaStyle: {
|
||||||
|
color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
dataZoom: {
|
||||||
|
dataBackgroundColor: '#dedede',
|
||||||
|
fillerColor: 'rgba(154,217,247,0.2)',
|
||||||
|
handleColor: '#005eaa'
|
||||||
|
},
|
||||||
|
|
||||||
|
timeline: {
|
||||||
|
lineStyle: {
|
||||||
|
color: '#005eaa'
|
||||||
|
},
|
||||||
|
controlStyle: {
|
||||||
|
color: '#005eaa',
|
||||||
|
borderColor: '#005eaa'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
candlestick: {
|
||||||
|
itemStyle: {
|
||||||
|
color: '#c12e34',
|
||||||
|
color0: '#2b821d'
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
width: 1,
|
||||||
|
color: '#c12e34',
|
||||||
|
color0: '#2b821d'
|
||||||
|
},
|
||||||
|
areaStyle: {
|
||||||
|
color: '#e6b600',
|
||||||
|
color0: '#005eaa'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
graph: {
|
||||||
|
itemStyle: {
|
||||||
|
color: '#e6b600'
|
||||||
|
},
|
||||||
|
linkStyle: {
|
||||||
|
color: '#005eaa'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
map: {
|
||||||
|
itemStyle: {
|
||||||
|
color: '#f2385a',
|
||||||
|
borderColor: '#eee',
|
||||||
|
areaColor: '#ddd'
|
||||||
|
},
|
||||||
|
areaStyle: {
|
||||||
|
color: '#ddd'
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
color: '#c12e34'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
gauge: {
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
color: [
|
||||||
|
[0.2, '#2b821d'],
|
||||||
|
[0.8, '#005eaa'],
|
||||||
|
[1, '#c12e34']
|
||||||
|
],
|
||||||
|
width: 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
axisTick: {
|
||||||
|
splitNumber: 10,
|
||||||
|
length: 8,
|
||||||
|
lineStyle: {
|
||||||
|
color: 'auto'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
axisLabel: {
|
||||||
|
textStyle: {
|
||||||
|
color: 'auto'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
length: 12,
|
||||||
|
lineStyle: {
|
||||||
|
color: 'auto'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pointer: {
|
||||||
|
length: '90%',
|
||||||
|
width: 3,
|
||||||
|
color: 'auto'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
textStyle: {
|
||||||
|
color: '#333'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
detail: {
|
||||||
|
textStyle: {
|
||||||
|
color: 'auto'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
echarts.registerTheme('myShine', theme);
|
||||||
|
});
|
@ -384,7 +384,8 @@ export const yesNoName = [
|
|||||||
"longEatDrugFlag",
|
"longEatDrugFlag",
|
||||||
"allergyFlag",
|
"allergyFlag",
|
||||||
"smokeFlag",
|
"smokeFlag",
|
||||||
"secondSmoke"
|
"secondSmoke",
|
||||||
|
"sleepDrugFlag"
|
||||||
];
|
];
|
||||||
|
|
||||||
export const dictName = [
|
export const dictName = [
|
||||||
@ -550,7 +551,7 @@ export function dealHealthy(customerHealthy) {
|
|||||||
customerHealthy.getupTime += "点";
|
customerHealthy.getupTime += "点";
|
||||||
}
|
}
|
||||||
if (customerHealthy.hasOwnProperty("signList")) {
|
if (customerHealthy.hasOwnProperty("signList")) {
|
||||||
customerHealthy.signStr = customerHealthy.signList
|
customerHealthy.signStr = (customerHealthy.signList || [])
|
||||||
.map(obj => obj.name)
|
.map(obj => obj.name)
|
||||||
.join(",");
|
.join(",");
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="岗位" prop="postId">
|
<el-form-item label="岗位" prop="postId">
|
||||||
<el-select v-model="queryParams.postId" placeholder="请选择岗位" clearable size="small" @change="searchPostChange">
|
<el-select
|
||||||
|
v-model="queryParams.postId"
|
||||||
|
placeholder="请选择岗位"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@change="searchPostChange"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in postIdOptions"
|
v-for="dict in postIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -12,7 +24,12 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="业务员" prop="userId">
|
<el-form-item label="业务员" prop="userId">
|
||||||
<el-select v-model="queryParams.userId" placeholder="请选择业务员" clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.userId"
|
||||||
|
placeholder="请选择业务员"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in searchUserIdOptions"
|
v-for="dict in searchUserIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -22,8 +39,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -70,11 +95,18 @@
|
|||||||
<!-- >导出-->
|
<!-- >导出-->
|
||||||
<!-- </el-button>-->
|
<!-- </el-button>-->
|
||||||
<!-- </el-col>-->
|
<!-- </el-col>-->
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="commisionList" :span-method="objectSpanMethod"
|
<el-table
|
||||||
@selection-change="handleSelectionChange">
|
v-loading="loading"
|
||||||
|
:data="commisionList"
|
||||||
|
:span-method="objectSpanMethod"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column label="业务员" align="center" prop="userName" />
|
<el-table-column label="业务员" align="center" prop="userName" />
|
||||||
<el-table-column label="岗位" align="center" prop="postName" />
|
<el-table-column label="岗位" align="center" prop="postName" />
|
||||||
<el-table-column label="金额" align="center" prop="amount">
|
<el-table-column label="金额" align="center" prop="amount">
|
||||||
@ -84,11 +116,15 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="比例" align="center" prop="rate">
|
<el-table-column label="比例" align="center" prop="rate">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
{{scope.row.rate + '%'}}
|
{{ scope.row.rate + "%" }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -124,7 +160,11 @@
|
|||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="岗位" prop="postId">
|
<el-form-item label="岗位" prop="postId">
|
||||||
<el-select v-model="form.postId" placeholder="请选择岗位" @change="postChange">
|
<el-select
|
||||||
|
v-model="form.postId"
|
||||||
|
placeholder="请选择岗位"
|
||||||
|
@change="postChange"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in postIdOptions"
|
v-for="dict in postIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -158,7 +198,11 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -181,7 +225,7 @@
|
|||||||
exportCommision,
|
exportCommision,
|
||||||
} from "@/api/custom/commision";
|
} from "@/api/custom/commision";
|
||||||
|
|
||||||
import {getOptions} from "@/api/custom/order";
|
import { getOptions } from "@/api/custom/global";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CommisionConfig",
|
name: "CommisionConfig",
|
||||||
@ -229,23 +273,21 @@
|
|||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
userId: [
|
userId: [
|
||||||
{required: true, message: "业务员不能为空", trigger: "change"}
|
{ required: true, message: "业务员不能为空", trigger: "change" },
|
||||||
],
|
],
|
||||||
postId: [
|
postId: [
|
||||||
{required: true, message: "岗位不能为空", trigger: "change"}
|
{ required: true, message: "岗位不能为空", trigger: "change" },
|
||||||
],
|
|
||||||
amount: [
|
|
||||||
{required: true, message: "金额不能为空", trigger: "blur"}
|
|
||||||
],
|
],
|
||||||
|
amount: [{ required: true, message: "金额不能为空", trigger: "blur" }],
|
||||||
rate: [
|
rate: [
|
||||||
{required: true, message: "分成比例不能为空", trigger: "blur"}
|
{ required: true, message: "分成比例不能为空", trigger: "blur" },
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
getOptions().then(response => {
|
getOptions().then((response) => {
|
||||||
this.options = response.data.reduce((opts, cur) => {
|
this.options = response.data.reduce((opts, cur) => {
|
||||||
// if (cur.postCode.startsWith('planner')) {
|
// if (cur.postCode.startsWith('planner')) {
|
||||||
// return opts;
|
// return opts;
|
||||||
@ -253,28 +295,42 @@
|
|||||||
if (!opts[cur.postId]) {
|
if (!opts[cur.postId]) {
|
||||||
opts[cur.postId] = [];
|
opts[cur.postId] = [];
|
||||||
}
|
}
|
||||||
opts[cur.postId].push({dictValue: cur.userId, dictLabel: cur.userName});
|
opts[cur.postId].push({
|
||||||
|
dictValue: cur.userId,
|
||||||
|
dictLabel: cur.userName,
|
||||||
|
});
|
||||||
|
|
||||||
if (!this.postIdOptions.some(opt => opt.dictValue === cur.postId)) {
|
if (!this.postIdOptions.some((opt) => opt.dictValue === cur.postId)) {
|
||||||
this.postIdOptions.push({dictValue: cur.postId, dictLabel: cur.postName});
|
this.postIdOptions.push({
|
||||||
|
dictValue: cur.postId,
|
||||||
|
dictLabel: cur.postName,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!this.totalUserIdOptions.some(opt => opt.dictValue === cur.userId)) {
|
if (
|
||||||
this.totalUserIdOptions.push({dictValue: cur.userId, dictLabel: cur.userName});
|
!this.totalUserIdOptions.some((opt) => opt.dictValue === cur.userId)
|
||||||
|
) {
|
||||||
|
this.totalUserIdOptions.push({
|
||||||
|
dictValue: cur.userId,
|
||||||
|
dictLabel: cur.userName,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return opts;
|
return opts;
|
||||||
}, {});
|
}, {});
|
||||||
this.searchUserIdOptions = this.totalUserIdOptions.slice();
|
this.searchUserIdOptions = this.totalUserIdOptions.slice();
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询业务提成比例列表 */
|
/** 查询业务提成比例列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listCommision(this.queryParams).then(response => {
|
listCommision(this.queryParams).then((response) => {
|
||||||
this.commisionList = response.rows.reduce((arr, cur, idx, oriArr) => {
|
this.commisionList = response.rows.reduce((arr, cur, idx, oriArr) => {
|
||||||
for (let i = 0; i < arr.length; i++) {
|
for (let i = 0; i < arr.length; i++) {
|
||||||
if (arr[i].some(e => e.userId === cur.userId && e.postId === cur.postId)) {
|
if (
|
||||||
|
arr[i].some(
|
||||||
|
(e) => e.userId === cur.userId && e.postId === cur.postId
|
||||||
|
)
|
||||||
|
) {
|
||||||
arr[i].push(cur);
|
arr[i].push(cur);
|
||||||
break;
|
break;
|
||||||
} else if (i === arr.length - 1) {
|
} else if (i === arr.length - 1) {
|
||||||
@ -287,27 +343,32 @@
|
|||||||
}
|
}
|
||||||
if (idx === oriArr.length - 1) {
|
if (idx === oriArr.length - 1) {
|
||||||
const finalArr = [];
|
const finalArr = [];
|
||||||
arr.forEach(tmpArr => {
|
arr.forEach((tmpArr) => {
|
||||||
tmpArr.sort((a, b) => a.amount - b.amount)
|
tmpArr
|
||||||
|
.sort((a, b) => a.amount - b.amount)
|
||||||
.forEach((elm, elmIdx) => {
|
.forEach((elm, elmIdx) => {
|
||||||
finalArr.push({
|
finalArr.push({
|
||||||
...elm,
|
...elm,
|
||||||
userSpan: elmIdx ? {
|
userSpan: elmIdx
|
||||||
|
? {
|
||||||
rowspan: 0,
|
rowspan: 0,
|
||||||
colspan: 0
|
colspan: 0,
|
||||||
} : {
|
|
||||||
rowspan: tmpArr.length,
|
|
||||||
colspan: 1
|
|
||||||
},
|
|
||||||
postSpan: elmIdx ? {
|
|
||||||
rowspan: 0,
|
|
||||||
colspan: 0
|
|
||||||
} : {
|
|
||||||
rowspan: tmpArr.length,
|
|
||||||
colspan: 1
|
|
||||||
}
|
}
|
||||||
})
|
: {
|
||||||
})
|
rowspan: tmpArr.length,
|
||||||
|
colspan: 1,
|
||||||
|
},
|
||||||
|
postSpan: elmIdx
|
||||||
|
? {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
rowspan: tmpArr.length,
|
||||||
|
colspan: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return finalArr;
|
return finalArr;
|
||||||
}
|
}
|
||||||
@ -339,7 +400,7 @@
|
|||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
remark: null
|
remark: null,
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -356,9 +417,9 @@
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.ruleId)
|
this.ids = selection.map((item) => item.ruleId);
|
||||||
this.single = selection.length !== 1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -369,8 +430,8 @@
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const ruleId = row.ruleId || this.ids
|
const ruleId = row.ruleId || this.ids;
|
||||||
getCommision(ruleId, row.postId).then(response => {
|
getCommision(ruleId, row.postId).then((response) => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.userIdOptions = this.options[this.form.postId];
|
this.userIdOptions = this.options[this.form.postId];
|
||||||
this.open = true;
|
this.open = true;
|
||||||
@ -379,10 +440,10 @@
|
|||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.ruleId != null) {
|
if (this.form.ruleId != null) {
|
||||||
updateCommision(this.form).then(response => {
|
updateCommision(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -390,7 +451,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addCommision(this.form).then(response => {
|
addCommision(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -404,31 +465,39 @@
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ruleIds = row.ruleId || this.ids;
|
const ruleIds = row.ruleId || this.ids;
|
||||||
this.$confirm('是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?', "警告", {
|
this.$confirm(
|
||||||
|
'是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?',
|
||||||
|
"警告",
|
||||||
|
{
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function () {
|
}
|
||||||
|
)
|
||||||
|
.then(function () {
|
||||||
return delCommision(ruleIds);
|
return delCommision(ruleIds);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
}).catch(function () {
|
})
|
||||||
});
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
|
this.$confirm("是否确认导出所有业务提成比例数据项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function () {
|
})
|
||||||
|
.then(function () {
|
||||||
return exportCommision(queryParams);
|
return exportCommision(queryParams);
|
||||||
}).then(response => {
|
})
|
||||||
|
.then((response) => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
}).catch(function () {
|
})
|
||||||
});
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||||
if (columnIndex === 0) {
|
if (columnIndex === 0) {
|
||||||
@ -447,7 +516,7 @@
|
|||||||
}
|
}
|
||||||
this.searchUserIdOptions = this.options[postId];
|
this.searchUserIdOptions = this.options[postId];
|
||||||
this.queryParams.userId = null;
|
this.queryParams.userId = null;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,8 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="岗位" prop="postId">
|
<el-form-item label="岗位" prop="postId">
|
||||||
<el-select v-model="queryParams.postId" placeholder="请选择岗位" clearable size="small" @change="searchPostChange">
|
<el-select
|
||||||
|
v-model="queryParams.postId"
|
||||||
|
placeholder="请选择岗位"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@change="searchPostChange"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in postIdOptions"
|
v-for="dict in postIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -12,7 +24,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="业务员" prop="userId">
|
<el-form-item label="业务员" prop="userId">
|
||||||
<el-select v-model="queryParams.userId" filterable placeholder="请选择业务员" clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.userId"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择业务员"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in searchUserIdOptions"
|
v-for="dict in searchUserIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -26,12 +44,21 @@
|
|||||||
v-model="month"
|
v-model="month"
|
||||||
@change="monthRangeChange"
|
@change="monthRangeChange"
|
||||||
type="month"
|
type="month"
|
||||||
placeholder="选择月">
|
placeholder="选择月"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -46,11 +73,17 @@
|
|||||||
>导出
|
>导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="commisionList"
|
<el-table
|
||||||
@selection-change="handleSelectionChange">
|
v-loading="loading"
|
||||||
|
:data="commisionList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column label="业务员" align="center" prop="userName" />
|
<el-table-column label="业务员" align="center" prop="userName" />
|
||||||
<el-table-column label="岗位" align="center" prop="postName" />
|
<el-table-column label="岗位" align="center" prop="postName" />
|
||||||
<el-table-column label="总金额" align="center" prop="amount">
|
<el-table-column label="总金额" align="center" prop="amount">
|
||||||
@ -60,7 +93,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="比例" align="center" prop="rate">
|
<el-table-column label="比例" align="center" prop="rate">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
{{scope.row.rate + '%'}}
|
{{ scope.row.rate + "%" }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="提成" align="center" prop="commision">
|
<el-table-column label="提成" align="center" prop="commision">
|
||||||
@ -86,14 +119,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { detailCommision, exportCommision } from "@/api/custom/commision";
|
||||||
detailCommision,
|
|
||||||
exportCommision,
|
|
||||||
} from "@/api/custom/commision";
|
|
||||||
|
|
||||||
import {getOptions} from "@/api/custom/order";
|
import { getOptions } from "@/api/custom/global";
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CommisionDetail",
|
name: "CommisionDetail",
|
||||||
@ -138,7 +168,7 @@
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
getOptions().then(response => {
|
getOptions().then((response) => {
|
||||||
this.options = response.data.reduce((opts, cur) => {
|
this.options = response.data.reduce((opts, cur) => {
|
||||||
// if (cur.postCode.startsWith('planner')) {
|
// if (cur.postCode.startsWith('planner')) {
|
||||||
// return opts;
|
// return opts;
|
||||||
@ -146,32 +176,49 @@
|
|||||||
if (!opts[cur.postId]) {
|
if (!opts[cur.postId]) {
|
||||||
opts[cur.postId] = [];
|
opts[cur.postId] = [];
|
||||||
}
|
}
|
||||||
opts[cur.postId].push({dictValue: cur.userId, dictLabel: cur.userName});
|
opts[cur.postId].push({
|
||||||
|
dictValue: cur.userId,
|
||||||
|
dictLabel: cur.userName,
|
||||||
|
});
|
||||||
|
|
||||||
if (!this.postIdOptions.some(opt => opt.dictValue === cur.postId)) {
|
if (!this.postIdOptions.some((opt) => opt.dictValue === cur.postId)) {
|
||||||
this.postIdOptions.push({dictValue: cur.postId, dictLabel: cur.postName});
|
this.postIdOptions.push({
|
||||||
|
dictValue: cur.postId,
|
||||||
|
dictLabel: cur.postName,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!this.totalUserIdOptions.some(opt => opt.dictValue === cur.userId)) {
|
if (
|
||||||
this.totalUserIdOptions.push({dictValue: cur.userId, dictLabel: cur.userName});
|
!this.totalUserIdOptions.some((opt) => opt.dictValue === cur.userId)
|
||||||
|
) {
|
||||||
|
this.totalUserIdOptions.push({
|
||||||
|
dictValue: cur.userId,
|
||||||
|
dictLabel: cur.userName,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return opts;
|
return opts;
|
||||||
}, {});
|
}, {});
|
||||||
this.postIdOptions = this.postIdOptions.sort((a, b) => a.dictValue - b.dictValue);
|
this.postIdOptions = this.postIdOptions.sort(
|
||||||
|
(a, b) => a.dictValue - b.dictValue
|
||||||
|
);
|
||||||
this.searchUserIdOptions = this.totalUserIdOptions.slice();
|
this.searchUserIdOptions = this.totalUserIdOptions.slice();
|
||||||
})
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询业务提成比例列表 */
|
/** 查询业务提成比例列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const dateRange = [dayjs(this.month).startOf('month').format('YYYY-MM-DD'), dayjs(this.month).endOf('month').format('YYYY-MM-DD')];
|
const dateRange = [
|
||||||
|
dayjs(this.month).startOf("month").format("YYYY-MM-DD"),
|
||||||
|
dayjs(this.month).endOf("month").format("YYYY-MM-DD"),
|
||||||
|
];
|
||||||
// console.log(dateRange)
|
// console.log(dateRange)
|
||||||
detailCommision(this.addDateRange(this.queryParams, dateRange)).then(response => {
|
detailCommision(this.addDateRange(this.queryParams, dateRange)).then(
|
||||||
|
(response) => {
|
||||||
this.commisionList = response.rows;
|
this.commisionList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
// 业务员字典翻译
|
// 业务员字典翻译
|
||||||
userIdFormat(row, column) {
|
userIdFormat(row, column) {
|
||||||
@ -195,23 +242,25 @@
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.ruleId)
|
this.ids = selection.map((item) => item.ruleId);
|
||||||
this.single = selection.length !== 1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
|
this.$confirm("是否确认导出所有业务提成比例数据项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function () {
|
})
|
||||||
|
.then(function () {
|
||||||
return exportCommision(queryParams);
|
return exportCommision(queryParams);
|
||||||
}).then(response => {
|
})
|
||||||
|
.then((response) => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
}).catch(function () {
|
})
|
||||||
});
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
monthRangeChange(time) {
|
monthRangeChange(time) {
|
||||||
this.month = time;
|
this.month = time;
|
||||||
@ -226,7 +275,7 @@
|
|||||||
}
|
}
|
||||||
this.searchUserIdOptions = this.options[postId];
|
this.searchUserIdOptions = this.options[postId];
|
||||||
this.queryParams.userId = null;
|
this.queryParams.userId = null;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,8 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="岗位" prop="postId">
|
<el-form-item label="岗位" prop="postId">
|
||||||
<el-select v-model="queryParams.postId" placeholder="请选择岗位" clearable size="small" @change="searchPostChange">
|
<el-select
|
||||||
|
v-model="queryParams.postId"
|
||||||
|
placeholder="请选择岗位"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@change="searchPostChange"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in postIdOptions"
|
v-for="dict in postIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -12,7 +24,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="业务员" prop="userId">
|
<el-form-item label="业务员" prop="userId">
|
||||||
<el-select v-model="queryParams.userId" filterable placeholder="请选择业务员" clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.userId"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择业务员"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in searchUserIdOptions"
|
v-for="dict in searchUserIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -26,20 +44,31 @@
|
|||||||
v-model="month"
|
v-model="month"
|
||||||
@change="monthRangeChange"
|
@change="monthRangeChange"
|
||||||
type="month"
|
type="month"
|
||||||
placeholder="选择月份">
|
placeholder="选择月份"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div><span style="color:#E6A23C;font-family:PingFang SC">
|
<div>
|
||||||
|
<span style="color: #e6a23c; font-family: PingFang SC">
|
||||||
注意事项:
|
注意事项:
|
||||||
<br />1、2021年1月开始的订单才开始按天计算提成,只计算已审核的订单
|
<br />1、2021年1月开始的订单才开始按天计算提成,只计算已审核的订单
|
||||||
<br />2、发工资日期定为每月15号,若当前日期大于15号,则认定上个月的工资已发放
|
<br />2、发工资日期定为每月15号,若当前日期大于15号,则认定上个月的工资已发放
|
||||||
</span></div>
|
</span>
|
||||||
<el-row :gutter="10" class="mb8" style="margin-top:10px;">
|
</div>
|
||||||
|
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
@ -50,49 +79,73 @@
|
|||||||
>导出
|
>导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="commisionList"
|
<el-table
|
||||||
@selection-change="handleSelectionChange" stripe :row-class-name="tableRowClassName">
|
v-loading="loading"
|
||||||
|
:data="commisionList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
stripe
|
||||||
|
:row-class-name="tableRowClassName"
|
||||||
|
>
|
||||||
<el-table-column label="业务员" align="center" prop="nickName">
|
<el-table-column label="业务员" align="center" prop="nickName">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.nickName }}</span>
|
<span>{{ scope.row.nickName }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="岗位" align="center" prop="postName" />
|
<el-table-column label="岗位" align="center" prop="postName" />
|
||||||
<el-table-column label="总提成" align="center" prop="totalCommissionAmount">
|
<el-table-column
|
||||||
|
label="总提成"
|
||||||
|
align="center"
|
||||||
|
prop="totalCommissionAmount"
|
||||||
|
>
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
{{ scope.row.totalCommissionAmount.toFixed(fixLength) }}
|
{{ scope.row.totalCommissionAmount.toFixed(fixLength) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="已发放提成" align="center" prop="totalHasSentCommissionAmount">
|
<el-table-column
|
||||||
|
label="已发放提成"
|
||||||
|
align="center"
|
||||||
|
prop="totalHasSentCommissionAmount"
|
||||||
|
>
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
{{ scope.row.totalHasSentCommissionAmount.toFixed(fixLength) }}
|
{{ scope.row.totalHasSentCommissionAmount.toFixed(fixLength) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="未发放提成" align="center" prop="totalNotSentCommissionAmount">
|
<el-table-column
|
||||||
|
label="未发放提成"
|
||||||
|
align="center"
|
||||||
|
prop="totalNotSentCommissionAmount"
|
||||||
|
>
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
{{ scope.row.totalNotSentCommissionAmount.toFixed(fixLength) }}
|
{{ scope.row.totalNotSentCommissionAmount.toFixed(fixLength) }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="下月应发提成" align="center" prop="nextMonthCommission">
|
<el-table-column
|
||||||
|
label="下月应发提成"
|
||||||
|
align="center"
|
||||||
|
prop="nextMonthCommission"
|
||||||
|
>
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
{{ scope.row.nextMonthCommission.toFixed(fixLength) }}
|
{{ scope.row.nextMonthCommission.toFixed(fixLength) }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<el-button type="text" @click="openFormDialog('查看发放计划', scope.row)">查看发放计划</el-button>
|
<el-button
|
||||||
|
type="text"
|
||||||
|
@click="openFormDialog('查看发放计划', scope.row)"
|
||||||
|
>查看发放计划</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<!--<el-table-column label="提成" align="center" prop="commissionTotalAmount"></el-table-column>-->
|
<!--<el-table-column label="提成" align="center" prop="commissionTotalAmount"></el-table-column>-->
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
@ -103,16 +156,34 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
<el-dialog title="提成发放计划" :visible.sync="sendCommissionPlanTable" width="40%" align="center">
|
title="提成发放计划"
|
||||||
<el-table :data="sendCommissionPlan.list" show-summary :summary-method="getSummaries">
|
:visible.sync="sendCommissionPlanTable"
|
||||||
<el-table-column property="nickName" label="姓名" width="150"></el-table-column>
|
width="40%"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
:data="sendCommissionPlan.list"
|
||||||
|
show-summary
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
property="nickName"
|
||||||
|
label="姓名"
|
||||||
|
width="150"
|
||||||
|
></el-table-column>
|
||||||
<el-table-column property="yearMonth" label="提成月份" width="200">
|
<el-table-column property="yearMonth" label="提成月份" width="200">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
{{scope.row.yearMonth.substring(0, 4)}}年{{scope.row.yearMonth.substring(4)}}月
|
{{ scope.row.yearMonth.substring(0, 4) }}年{{
|
||||||
|
scope.row.yearMonth.substring(4)
|
||||||
|
}}月
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column property="yearMonthCommission" label="提成金额" width="100">
|
<el-table-column
|
||||||
|
property="yearMonthCommission"
|
||||||
|
label="提成金额"
|
||||||
|
width="100"
|
||||||
|
>
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
{{ scope.row.yearMonthCommission.toFixed(fixLength) }}
|
{{ scope.row.yearMonthCommission.toFixed(fixLength) }}
|
||||||
</template>
|
</template>
|
||||||
@ -129,17 +200,16 @@
|
|||||||
|
|
||||||
.el-table .success-row {
|
.el-table .success-row {
|
||||||
/*background: #1890FF;*/
|
/*background: #1890FF;*/
|
||||||
color: #1890FF
|
color: #1890ff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { detailDayCommision, exportDayCommision } from "@/api/custom/commision";
|
||||||
detailDayCommision, exportDayCommision} from "@/api/custom/commision";
|
|
||||||
|
|
||||||
import {getOptions} from "@/api/custom/order";
|
import { getOptions } from "@/api/custom/global";
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CommisionDayDetail",
|
name: "CommisionDayDetail",
|
||||||
@ -182,45 +252,62 @@
|
|||||||
},
|
},
|
||||||
sendCommissionPlanTable: false,
|
sendCommissionPlanTable: false,
|
||||||
sendCommissionPlan: {},
|
sendCommissionPlan: {},
|
||||||
fixLength: 2
|
fixLength: 2,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
getOptions().then(response => {
|
getOptions().then((response) => {
|
||||||
this.options = response.data.reduce((opts, cur) => {
|
this.options = response.data.reduce((opts, cur) => {
|
||||||
if (cur.postCode != ('after_sale') && cur.postCode != 'nutri') {
|
if (cur.postCode != "after_sale" && cur.postCode != "nutri") {
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
if (!opts[cur.postId]) {
|
if (!opts[cur.postId]) {
|
||||||
opts[cur.postId] = [];
|
opts[cur.postId] = [];
|
||||||
}
|
}
|
||||||
opts[cur.postId].push({dictValue: cur.userId, dictLabel: cur.userName});
|
opts[cur.postId].push({
|
||||||
|
dictValue: cur.userId,
|
||||||
|
dictLabel: cur.userName,
|
||||||
|
});
|
||||||
|
|
||||||
if (!this.postIdOptions.some(opt => opt.dictValue === cur.postId)) {
|
if (!this.postIdOptions.some((opt) => opt.dictValue === cur.postId)) {
|
||||||
this.postIdOptions.push({dictValue: cur.postId, dictLabel: cur.postName});
|
this.postIdOptions.push({
|
||||||
|
dictValue: cur.postId,
|
||||||
|
dictLabel: cur.postName,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!this.totalUserIdOptions.some(opt => opt.dictValue === cur.userId)) {
|
if (
|
||||||
this.totalUserIdOptions.push({dictValue: cur.userId, dictLabel: cur.userName});
|
!this.totalUserIdOptions.some((opt) => opt.dictValue === cur.userId)
|
||||||
|
) {
|
||||||
|
this.totalUserIdOptions.push({
|
||||||
|
dictValue: cur.userId,
|
||||||
|
dictLabel: cur.userName,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return opts;
|
return opts;
|
||||||
}, {});
|
}, {});
|
||||||
this.postIdOptions = this.postIdOptions.sort((a, b) => a.dictValue - b.dictValue);
|
this.postIdOptions = this.postIdOptions.sort(
|
||||||
|
(a, b) => a.dictValue - b.dictValue
|
||||||
|
);
|
||||||
this.searchUserIdOptions = this.totalUserIdOptions.slice();
|
this.searchUserIdOptions = this.totalUserIdOptions.slice();
|
||||||
})
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询业务提成比例列表 */
|
/** 查询业务提成比例列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const dateRange = [dayjs(this.month).startOf('month').format('YYYY-MM-DD'), dayjs(this.month).endOf('month').format('YYYY-MM-DD')];
|
const dateRange = [
|
||||||
|
dayjs(this.month).startOf("month").format("YYYY-MM-DD"),
|
||||||
|
dayjs(this.month).endOf("month").format("YYYY-MM-DD"),
|
||||||
|
];
|
||||||
// console.log(dateRange)
|
// console.log(dateRange)
|
||||||
detailDayCommision(this.addDateRange(this.queryParams, dateRange)).then(response => {
|
detailDayCommision(this.addDateRange(this.queryParams, dateRange)).then(
|
||||||
|
(response) => {
|
||||||
this.commisionList = response.rows;
|
this.commisionList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
// 业务员字典翻译
|
// 业务员字典翻译
|
||||||
userIdFormat(row, column) {
|
userIdFormat(row, column) {
|
||||||
@ -244,23 +331,25 @@
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.ruleId)
|
this.ids = selection.map((item) => item.ruleId);
|
||||||
this.single = selection.length !== 1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
|
this.$confirm("是否确认导出所有业务提成比例数据项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function () {
|
})
|
||||||
|
.then(function () {
|
||||||
return exportDayCommision(queryParams);
|
return exportDayCommision(queryParams);
|
||||||
}).then(response => {
|
})
|
||||||
|
.then((response) => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
}).catch(function () {
|
})
|
||||||
});
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
monthRangeChange(time) {
|
monthRangeChange(time) {
|
||||||
this.month = time;
|
this.month = time;
|
||||||
@ -295,12 +384,12 @@
|
|||||||
const sums = [];
|
const sums = [];
|
||||||
columns.forEach((column, index) => {
|
columns.forEach((column, index) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
sums[index] = '合计';
|
sums[index] = "合计";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (index == 1) {
|
if (index == 1) {
|
||||||
sums[index] = data.length + "个月";
|
sums[index] = data.length + "个月";
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (index == 2) {
|
if (index == 2) {
|
||||||
sums[index] = this.sendCommissionPlan.total;
|
sums[index] = this.sendCommissionPlan.total;
|
||||||
@ -312,8 +401,8 @@
|
|||||||
if (this.commisionList.length == rowIndex + 1) {
|
if (this.commisionList.length == rowIndex + 1) {
|
||||||
return "success-row";
|
return "success-row";
|
||||||
}
|
}
|
||||||
return '';
|
return "";
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="合同编号" prop="id">
|
<el-form-item label="合同编号" prop="id">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.id"
|
v-model="queryParams.id"
|
||||||
@ -29,11 +35,18 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="主营养师" prop="nutritionistId">
|
<el-form-item label="主营养师" prop="nutritionistId">
|
||||||
<el-select v-model="queryParams.nutritionistId" placeholder="请选择主营养师" clearable size="small">
|
<el-select
|
||||||
<el-option v-for="dict in nutritionistIdOptions"
|
v-model="queryParams.nutritionistId"
|
||||||
|
placeholder="请选择主营养师"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutritionistIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="parseInt(dict.dictValue)"/>
|
:value="parseInt(dict.dictValue)"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="合同状态" prop="status">
|
<el-form-item label="合同状态" prop="status">
|
||||||
@ -47,8 +60,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -92,42 +113,100 @@
|
|||||||
<!-- v-hasPermi="['custom:contract:export']"-->
|
<!-- v-hasPermi="['custom:contract:export']"-->
|
||||||
<!-- >导出</el-button>-->
|
<!-- >导出</el-button>-->
|
||||||
<!-- </el-col>-->
|
<!-- </el-col>-->
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="contractList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||||
<el-table-column label="合同编号" align="center" prop="id" fixed="left" width="150"/>
|
<el-table-column
|
||||||
<el-table-column label="合同状态" align="center" prop="status" width="80" fixed="left">
|
label="合同编号"
|
||||||
|
align="center"
|
||||||
|
prop="id"
|
||||||
|
fixed="left"
|
||||||
|
width="150"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="合同状态"
|
||||||
|
align="center"
|
||||||
|
prop="status"
|
||||||
|
width="80"
|
||||||
|
fixed="left"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag
|
<el-tag
|
||||||
:type="scope.row.status === 'yes' ? 'success' : 'danger'"
|
:type="scope.row.status === 'yes' ? 'success' : 'danger'"
|
||||||
disable-transitions>
|
disable-transitions
|
||||||
{{scope.row.status === 'yes' ? '已签订':'未签订'}}
|
>
|
||||||
|
{{ scope.row.status === "yes" ? "已签订" : "未签订" }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="客户姓名" align="center" prop="name" fixed="left" width="200"/>
|
<el-table-column
|
||||||
|
label="客户姓名"
|
||||||
|
align="center"
|
||||||
|
prop="name"
|
||||||
|
fixed="left"
|
||||||
|
width="200"
|
||||||
|
/>
|
||||||
<el-table-column label="证件号" align="center" prop="cusId" width="190" />
|
<el-table-column label="证件号" align="center" prop="cusId" width="190" />
|
||||||
<el-table-column label="电话" align="center" prop="phone" width="120" />
|
<el-table-column label="电话" align="center" prop="phone" width="120" />
|
||||||
<el-table-column label="服务时间" align="center" prop="serveTime" :formatter="serveTimeFormat" width="100"/>
|
<el-table-column
|
||||||
<el-table-column label="服务承诺" align="center" prop="servePromise" width="100">
|
label="服务时间"
|
||||||
|
align="center"
|
||||||
|
prop="serveTime"
|
||||||
|
:formatter="serveTimeFormat"
|
||||||
|
width="100"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="服务承诺"
|
||||||
|
align="center"
|
||||||
|
prop="servePromise"
|
||||||
|
width="100"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.servePromise ? `${scope.row.servePromise}斤`: ''}}
|
{{ scope.row.servePromise ? `${scope.row.servePromise}斤` : "" }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="金额" align="center" prop="amount" width="100" />
|
<el-table-column label="金额" align="center" prop="amount" width="100" />
|
||||||
<el-table-column label="调理项目" align="center" prop="projectName" width="100"/>
|
<el-table-column
|
||||||
<el-table-column label="签订时间" align="center" prop="updateTime" width="180"/>
|
label="调理项目"
|
||||||
|
align="center"
|
||||||
|
prop="projectName"
|
||||||
|
width="100"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="签订时间"
|
||||||
|
align="center"
|
||||||
|
prop="updateTime"
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
<el-table-column label="合同地址" align="center" prop="path" width="80">
|
<el-table-column label="合同地址" align="center" prop="path" width="80">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" icon="el-icon-copy-document" @click="handleCopy(scope.row.path)" class="copyBtn"
|
<el-button
|
||||||
:data-clipboard-text="copyValue">复制
|
type="text"
|
||||||
|
icon="el-icon-copy-document"
|
||||||
|
@click="handleCopy(scope.row.path)"
|
||||||
|
class="copyBtn"
|
||||||
|
:data-clipboard-text="copyValue"
|
||||||
|
>复制
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" width="120" />
|
<el-table-column label="备注" align="center" prop="remark" width="120" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150">
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
fixed="right"
|
||||||
|
width="150"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.status === 'yes'"
|
v-if="scope.row.status === 'yes'"
|
||||||
@ -161,11 +240,19 @@
|
|||||||
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-form-item label="调理项目" prop="projectId">
|
<el-form-item label="调理项目" prop="projectId">
|
||||||
<el-select v-model="form.projectId" placeholder="请选择调理项目" filterable clearable size="small">
|
<el-select
|
||||||
<el-option v-for="dict in conditioningProjectIdOption"
|
v-model="form.projectId"
|
||||||
|
placeholder="请选择调理项目"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in conditioningProjectIdOption"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="parseInt(dict.dictValue)"/>
|
:value="parseInt(dict.dictValue)"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="客户姓名" prop="name">
|
<el-form-item label="客户姓名" prop="name">
|
||||||
@ -174,16 +261,31 @@
|
|||||||
<el-form-item label="金额" prop="amount">
|
<el-form-item label="金额" prop="amount">
|
||||||
<el-input v-model="form.amount" placeholder="请输入金额" />
|
<el-input v-model="form.amount" placeholder="请输入金额" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="服务承诺" prop="servePromise" v-show="form.projectId == 0">
|
<el-form-item
|
||||||
<el-input style="width: 193px; margin-right: 12px" v-model="form.servePromise" placeholder="请输入服务承诺"/>
|
label="服务承诺"
|
||||||
|
prop="servePromise"
|
||||||
|
v-show="form.projectId == 0"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
style="width: 193px; margin-right: 12px"
|
||||||
|
v-model="form.servePromise"
|
||||||
|
placeholder="请输入服务承诺"
|
||||||
|
/>
|
||||||
斤
|
斤
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="营养师" prop="nutritionistId">
|
<el-form-item label="营养师" prop="nutritionistId">
|
||||||
<el-select v-model="form.nutritionistId" placeholder="请选择营养师" clearable size="small">
|
<el-select
|
||||||
<el-option v-for="dict in nutritionistIdOptions"
|
v-model="form.nutritionistId"
|
||||||
|
placeholder="请选择营养师"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutritionistIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="parseInt(dict.dictValue)"/>
|
:value="parseInt(dict.dictValue)"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="服务时间" prop="serveTime">
|
<el-form-item label="服务时间" prop="serveTime">
|
||||||
@ -197,7 +299,11 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@ -211,16 +317,16 @@
|
|||||||
<script>
|
<script>
|
||||||
import { addContract, delContract, listContract } from "@/api/custom/contract";
|
import { addContract, delContract, listContract } from "@/api/custom/contract";
|
||||||
|
|
||||||
import {getOptions} from "@/api/custom/order";
|
import Clipboard from "clipboard";
|
||||||
|
|
||||||
import Clipboard from 'clipboard';
|
import { mapGetters } from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Contract",
|
name: "Contract",
|
||||||
data() {
|
data() {
|
||||||
const checkServePromise = (rule, value, callback) => {
|
const checkServePromise = (rule, value, callback) => {
|
||||||
if (this.form.projectId == 0 && !value) {
|
if (this.form.projectId == 0 && !value) {
|
||||||
return callback(new Error('请输入服务承诺'))
|
return callback(new Error("请输入服务承诺"));
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
};
|
};
|
||||||
@ -252,7 +358,7 @@
|
|||||||
//调理项目字典
|
//调理项目字典
|
||||||
conditioningProjectIdOption: [],
|
conditioningProjectIdOption: [],
|
||||||
//
|
//
|
||||||
copyValue: '',
|
copyValue: "",
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@ -267,11 +373,9 @@
|
|||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
projectId: [
|
projectId: [
|
||||||
{required: true, message: "请选择调理项目", trigger: "blur"}
|
{ required: true, message: "请选择调理项目", trigger: "blur" },
|
||||||
],
|
|
||||||
name: [
|
|
||||||
{required: true, message: "请输入客户姓名", trigger: "blur"}
|
|
||||||
],
|
],
|
||||||
|
name: [{ required: true, message: "请输入客户姓名", trigger: "blur" }],
|
||||||
amount: [
|
amount: [
|
||||||
{ required: true, message: "请输入签订金额", trigger: "blur" },
|
{ required: true, message: "请输入签订金额", trigger: "blur" },
|
||||||
{
|
{
|
||||||
@ -282,44 +386,38 @@
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
servePromise: [
|
servePromise: [
|
||||||
{required: true, trigger: "blur", validator: checkServePromise}
|
{ required: true, trigger: "blur", validator: checkServePromise },
|
||||||
],
|
],
|
||||||
serveTime: [
|
serveTime: [
|
||||||
{required: true, message: "请选择服务时间", trigger: "blur"}
|
{ required: true, message: "请选择服务时间", trigger: "blur" },
|
||||||
],
|
],
|
||||||
nutritionistId: [
|
nutritionistId: [
|
||||||
{required: true, message: "请选择营养师", trigger: "blur"}
|
{ required: true, message: "请选择营养师", trigger: "blur" },
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
getOptions().then(response => {
|
|
||||||
const options = response.data.reduce((opts, cur) => {
|
this.getDicts("cus_serve_time").then((response) => {
|
||||||
if (!opts[cur.postCode]) {
|
|
||||||
opts[cur.postCode] = [{dictValue: 0, dictLabel: ' ', remark: null}];
|
|
||||||
}
|
|
||||||
opts[cur.postCode].push({dictValue: cur.userId, dictLabel: cur.userName, remark: cur.remark})
|
|
||||||
return opts;
|
|
||||||
}, {})
|
|
||||||
this.nutritionistIdOptions = options['nutri'] || [];
|
|
||||||
})
|
|
||||||
this.getDicts("cus_serve_time").then(response => {
|
|
||||||
this.serveTimeOptions = response.data;
|
this.serveTimeOptions = response.data;
|
||||||
});
|
});
|
||||||
this.getDicts("cus_sign_status").then(response => {
|
this.getDicts("cus_sign_status").then((response) => {
|
||||||
this.signStatusOptions = response.data;
|
this.signStatusOptions = response.data;
|
||||||
});
|
});
|
||||||
this.getDicts("conditioning_project").then(response => {
|
this.getDicts("conditioning_project").then((response) => {
|
||||||
this.conditioningProjectIdOption = response.data;
|
this.conditioningProjectIdOption = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(["nutritionistIdOptions"]),
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询合同列表 */
|
/** 查询合同列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listContract(this.queryParams).then(response => {
|
listContract(this.queryParams).then((response) => {
|
||||||
this.contractList = response.rows;
|
this.contractList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@ -339,29 +437,40 @@
|
|||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
const defaultNutritionist = this.nutritionistIdOptions.find(opt => opt.remark === 'default');
|
const defaultNutritionist = this.nutritionistIdOptions.find(
|
||||||
const defaultProjectIdOption = this.conditioningProjectIdOption.find(opt => opt.remark === 'default');
|
(opt) => opt.remark === "default"
|
||||||
|
);
|
||||||
|
const defaultProjectIdOption = this.conditioningProjectIdOption.find(
|
||||||
|
(opt) => opt.remark === "default"
|
||||||
|
);
|
||||||
|
|
||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
projectId: defaultProjectIdOption ? parseInt(defaultProjectIdOption.dictValue) : null,
|
projectId: defaultProjectIdOption
|
||||||
|
? parseInt(defaultProjectIdOption.dictValue)
|
||||||
|
: null,
|
||||||
name: null,
|
name: null,
|
||||||
phone: null,
|
phone: null,
|
||||||
serveTime: null,
|
serveTime: null,
|
||||||
amount: null,
|
amount: null,
|
||||||
path: null,
|
path: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
nutritionistId: defaultNutritionist ? parseInt(defaultNutritionist.dictValue) : null,
|
nutritionistId: defaultNutritionist
|
||||||
|
? parseInt(defaultNutritionist.dictValue)
|
||||||
|
: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
remark: null
|
remark: null,
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
// 主营养师字典翻译
|
// 主营养师字典翻译
|
||||||
nutritionistIdFormat(row, column) {
|
nutritionistIdFormat(row, column) {
|
||||||
return this.selectDictLabel(this.nutritionistIdOptions, row.nutritionistId);
|
return this.selectDictLabel(
|
||||||
|
this.nutritionistIdOptions,
|
||||||
|
row.nutritionistId
|
||||||
|
);
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
@ -375,9 +484,9 @@
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map((item) => item.id);
|
||||||
this.single = selection.length !== 1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -397,7 +506,7 @@
|
|||||||
// },
|
// },
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// if (this.form.id != null) {
|
// if (this.form.id != null) {
|
||||||
// updateContract(this.form).then(response => {
|
// updateContract(this.form).then(response => {
|
||||||
@ -408,11 +517,14 @@
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// } else {
|
// } else {
|
||||||
this.form.tutor = this.selectDictLabel(this.nutritionistIdOptions, this.form.nutritionistId)
|
this.form.tutor = this.selectDictLabel(
|
||||||
|
this.nutritionistIdOptions,
|
||||||
|
this.form.nutritionistId
|
||||||
|
);
|
||||||
if (this.form.projectId != 0) {
|
if (this.form.projectId != 0) {
|
||||||
this.form.servePromise = null;
|
this.form.servePromise = null;
|
||||||
}
|
}
|
||||||
addContract(this.form).then(response => {
|
addContract(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -429,14 +541,16 @@
|
|||||||
this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", {
|
this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function () {
|
})
|
||||||
|
.then(function () {
|
||||||
return delContract(ids);
|
return delContract(ids);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
}).catch(function () {
|
})
|
||||||
});
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
// handleExport() {
|
// handleExport() {
|
||||||
@ -453,19 +567,19 @@
|
|||||||
// });
|
// });
|
||||||
// },
|
// },
|
||||||
handleCopy(path) {
|
handleCopy(path) {
|
||||||
this.copyValue = window.location.origin.replace('manage', 'sign') + path;
|
this.copyValue = window.location.origin.replace("manage", "sign") + path;
|
||||||
const btnCopy = new Clipboard('.copyBtn');
|
const btnCopy = new Clipboard(".copyBtn");
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '拷贝成功',
|
message: "拷贝成功",
|
||||||
type: 'success'
|
type: "success",
|
||||||
});
|
});
|
||||||
// btnCopy.destroy();
|
// btnCopy.destroy();
|
||||||
},
|
},
|
||||||
handleLook(path) {
|
handleLook(path) {
|
||||||
const url = window.location.origin.replace('manage', 'sign') + path;
|
const url = window.location.origin.replace("manage", "sign") + path;
|
||||||
// const url = "http://stsign.busyinn.com" + path;
|
// const url = "http://stsign.busyinn.com" + path;
|
||||||
window.open(url, '_blank');
|
window.open(url, "_blank");
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -149,7 +149,11 @@
|
|||||||
prop="salesman"
|
prop="salesman"
|
||||||
:formatter="preSaleIdFormat"
|
:formatter="preSaleIdFormat"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="订单" align="center" v-hasPermi="['custom:order:list']">
|
<el-table-column
|
||||||
|
label="订单"
|
||||||
|
align="center"
|
||||||
|
v-hasPermi="['custom:order:list']"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -159,7 +163,11 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合同" align="center" v-hasPermi="['custom:contract:list']">
|
<el-table-column
|
||||||
|
label="合同"
|
||||||
|
align="center"
|
||||||
|
v-hasPermi="['custom:contract:list']"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -169,7 +177,11 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="健康评估" align="center" v-hasPermi="['custom:healthy:list']">
|
<el-table-column
|
||||||
|
label="健康评估"
|
||||||
|
align="center"
|
||||||
|
v-hasPermi="['custom:healthy:list']"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -179,7 +191,11 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="外食热量统计" align="center" v-hasPermi="['custom:foodHeatStatistics:list']">
|
<el-table-column
|
||||||
|
label="外食热量统计"
|
||||||
|
align="center"
|
||||||
|
v-hasPermi="['custom:foodHeatStatistics:list']"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -189,7 +205,11 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -339,13 +359,11 @@ import {
|
|||||||
} from "@/api/custom/customer";
|
} from "@/api/custom/customer";
|
||||||
|
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
||||||
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";
|
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Customer",
|
name: "Customer",
|
||||||
@ -353,7 +371,7 @@ export default {
|
|||||||
"order-drawer": OrderDrawer,
|
"order-drawer": OrderDrawer,
|
||||||
"physical-signs-dialog": PhysicalSignsDialog,
|
"physical-signs-dialog": PhysicalSignsDialog,
|
||||||
"contract-drawer": ContractDrawer,
|
"contract-drawer": ContractDrawer,
|
||||||
"heatStatisticsDrawer": HeatStatisticsDrawer
|
heatStatisticsDrawer: HeatStatisticsDrawer,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const userId = store.getters && store.getters.userId;
|
const userId = store.getters && store.getters.userId;
|
||||||
@ -374,13 +392,13 @@ export default {
|
|||||||
// 客户档案表格数据
|
// 客户档案表格数据
|
||||||
customerCenterList: [],
|
customerCenterList: [],
|
||||||
// 售前字典
|
// 售前字典
|
||||||
preSaleIdOptions: [],
|
// preSaleIdOptions: [],
|
||||||
// 售后字典
|
// 售后字典
|
||||||
afterSaleIdOptions: [],
|
// afterSaleIdOptions: [],
|
||||||
// 主营养师字典
|
// 主营养师字典
|
||||||
nutritionistIdOptions: [],
|
// nutritionistIdOptions: [],
|
||||||
// 助理营养师字典
|
// 助理营养师字典
|
||||||
nutriAssisIdOptions: [],
|
// nutriAssisIdOptions: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
@ -437,25 +455,14 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
getOptions().then((response) => {
|
},
|
||||||
const options = response.data.reduce((opts, cur) => {
|
computed: {
|
||||||
if (!opts[cur.postCode]) {
|
...mapGetters([
|
||||||
opts[cur.postCode] = [
|
"preSaleIdOptions",
|
||||||
{ dictValue: 0, dictLabel: "无", remark: null },
|
"afterSaleIdOptions",
|
||||||
];
|
"nutritionistIdOptions",
|
||||||
}
|
"nutriAssisIdOptions",
|
||||||
opts[cur.postCode].push({
|
]),
|
||||||
dictValue: cur.userId,
|
|
||||||
dictLabel: cur.userName,
|
|
||||||
remark: cur.remark,
|
|
||||||
});
|
|
||||||
return opts;
|
|
||||||
}, {});
|
|
||||||
this.preSaleIdOptions = options["pre_sale"] || [];
|
|
||||||
this.afterSaleIdOptions = options["after_sale"] || [];
|
|
||||||
this.nutritionistIdOptions = options["nutri"] || [];
|
|
||||||
this.nutriAssisIdOptions = options["nutri_assis"] || [];
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询客户档案列表 */
|
/** 查询客户档案列表 */
|
||||||
|
@ -162,9 +162,9 @@
|
|||||||
<el-drawer
|
<el-drawer
|
||||||
:title="title"
|
:title="title"
|
||||||
:visible.sync="open"
|
:visible.sync="open"
|
||||||
|
:wrapperClosable="false"
|
||||||
size="50%"
|
size="50%"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
:close-on-click-modal="false"
|
|
||||||
>
|
>
|
||||||
<div class="drawer_content">
|
<div class="drawer_content">
|
||||||
<el-row class="content_detail">
|
<el-row class="content_detail">
|
||||||
@ -675,13 +675,13 @@ export default {
|
|||||||
.catch(function () {});
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
handleChange(value, direction, movedKeys) {
|
handleChange(value, direction, movedKeys) {
|
||||||
console.log({
|
// console.log({
|
||||||
oriIgdList: this.oriDataList,
|
// oriIgdList: this.oriDataList,
|
||||||
selIgdList: this.form.igdList,
|
// selIgdList: this.form.igdList,
|
||||||
ingDataList: this.ingDataList,
|
// ingDataList: this.ingDataList,
|
||||||
value,
|
// value,
|
||||||
ingType: this.ingType,
|
// ingType: this.ingType,
|
||||||
});
|
// });
|
||||||
const newTableData = [];
|
const newTableData = [];
|
||||||
this.selRec = [];
|
this.selRec = [];
|
||||||
this.selNotRec = [];
|
this.selNotRec = [];
|
||||||
|
@ -1,16 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="进粉日期" prop="fanTime">
|
<el-form-item label="进粉日期" prop="fanTime">
|
||||||
<el-date-picker clearable style="width: 200px"
|
<el-date-picker
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
v-model="queryParams.fanTime"
|
v-model="queryParams.fanTime"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="选择日期">
|
placeholder="选择日期"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="销售" prop="userId" label-width="68px">
|
<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"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -20,7 +34,12 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="进粉渠道" prop="accountId" label-width="88px">
|
<el-form-item label="进粉渠道" prop="accountId" label-width="88px">
|
||||||
<el-select v-model="queryParams.accountId" filterable placeholder="请选择渠道" clearable>
|
<el-select
|
||||||
|
v-model="queryParams.accountId"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择渠道"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in accountIdOptions"
|
v-for="dict in accountIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -30,8 +49,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="margin-left: 20px">
|
<el-form-item style="margin-left: 20px">
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -43,7 +70,8 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['custom:fanStatistics:add']"
|
v-hasPermi="['custom:fanStatistics:add']"
|
||||||
>新增</el-button>
|
>新增</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -53,7 +81,8 @@
|
|||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['custom:fanStatistics:edit']"
|
v-hasPermi="['custom:fanStatistics:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -63,7 +92,8 @@
|
|||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['custom:fanStatistics:remove']"
|
v-hasPermi="['custom:fanStatistics:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -72,16 +102,30 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['custom:fanStatistics:export']"
|
v-hasPermi="['custom:fanStatistics:export']"
|
||||||
>导出</el-button>
|
>导出</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="fanStatisticsList" stripe @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="fanStatisticsList"
|
||||||
|
stripe
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="进粉日期" align="center" prop="fanTime" width="180">
|
<el-table-column
|
||||||
|
label="进粉日期"
|
||||||
|
align="center"
|
||||||
|
prop="fanTime"
|
||||||
|
width="180"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.fanTime, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.fanTime, "{y}-{m}-{d}") }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="销售" align="center" prop="userName" />
|
<el-table-column label="销售" align="center" prop="userName" />
|
||||||
@ -94,7 +138,11 @@
|
|||||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>-->
|
</el-table-column>-->
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -102,14 +150,16 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['custom:fanStatistics:edit']"
|
v-hasPermi="['custom:fanStatistics:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['custom:fanStatistics:remove']"
|
v-hasPermi="['custom:fanStatistics:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -122,23 +172,33 @@
|
|||||||
layout="total, slot, sizes, prev, pager, next, jumper"
|
layout="total, slot, sizes, prev, pager, next, jumper"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
>
|
>
|
||||||
<span style="margin-right: 12px;font-size:13px;color:rgb(134 136 140)">总计进粉量: {{totalFanNum}}</span>
|
<span style="margin-right: 12px; font-size: 13px; color: rgb(134 136 140)"
|
||||||
|
>总计进粉量: {{ totalFanNum }}</span
|
||||||
|
>
|
||||||
</pagination>
|
</pagination>
|
||||||
|
|
||||||
|
|
||||||
<!-- 添加进粉统计对话框 -->
|
<!-- 添加进粉统计对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="进粉日期" prop="fanTime">
|
<el-form-item label="进粉日期" prop="fanTime">
|
||||||
<el-date-picker clearable style="width: 200px"
|
<el-date-picker
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
v-model="form.fanTime"
|
v-model="form.fanTime"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
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">
|
||||||
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small">
|
<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"
|
||||||
@ -147,10 +207,22 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<p style="margin: 20px auto 20px 40px;font-size: 16px;">请先选择销售,再填写每个微信号对应进粉数量</p>
|
<p style="margin: 20px auto 20px 40px; font-size: 16px">
|
||||||
|
请先选择销售,再填写每个微信号对应进粉数量
|
||||||
|
</p>
|
||||||
<div v-if="showWxFlag">
|
<div v-if="showWxFlag">
|
||||||
<div v-for="(item, index) in wxList" style="margin: 10px auto auto 40px;">
|
<div
|
||||||
<span>{{item.wxAccount}}</span><el-input-number controls-position="right" v-model="form.fanNum[index]" style="width: 150px;margin-left: 10px" :min="0" :max="1000000000"></el-input-number>
|
v-for="(item, index) in wxList"
|
||||||
|
style="margin: 10px auto auto 40px"
|
||||||
|
>
|
||||||
|
<span>{{ item.wxAccount }}</span
|
||||||
|
><el-input-number
|
||||||
|
controls-position="right"
|
||||||
|
v-model="form.fanNum[index]"
|
||||||
|
style="width: 150px; margin-left: 10px"
|
||||||
|
:min="0"
|
||||||
|
:max="1000000000"
|
||||||
|
></el-input-number>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -161,38 +233,56 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 修改进粉统计对话框 -->
|
<!-- 修改进粉统计对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="editOpen" width="500px" append-to-body>
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="editOpen"
|
||||||
|
width="500px"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
<el-form ref="editForm" :model="editForm" :rules="editRules">
|
<el-form ref="editForm" :model="editForm" :rules="editRules">
|
||||||
<el-form-item label="进粉日期" prop="fanTime">
|
<el-form-item label="进粉日期" prop="fanTime">
|
||||||
<el-date-picker clearable style="width: 200px"
|
<el-date-picker
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
v-model="editForm.fanTime"
|
v-model="editForm.fanTime"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="选择日期">
|
placeholder="选择日期"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="进粉数量" prop="fanNum">
|
<el-form-item label="进粉数量" prop="fanNum">
|
||||||
<el-input-number controls-position="right" v-model="editForm.fanNum" :min="0" :max="1000000000"></el-input-number>
|
<el-input-number
|
||||||
|
controls-position="right"
|
||||||
|
v-model="editForm.fanNum"
|
||||||
|
:min="0"
|
||||||
|
:max="1000000000"
|
||||||
|
></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="editSubmit">确 定</el-button>
|
<el-button type="primary" @click="editSubmit">确 定</el-button>
|
||||||
<el-button @click="editCancel">取 消</el-button>
|
<el-button @click="editCancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listFanStatistics, getFanStatistics, delFanStatistics, addFanStatistics, updateFanStatistics, exportFanStatistics, getWxByUserId } from "@/api/custom/fanStatistics";
|
import {
|
||||||
import { getOptions } from "@/api/custom/order";
|
listFanStatistics,
|
||||||
|
getFanStatistics,
|
||||||
|
delFanStatistics,
|
||||||
|
addFanStatistics,
|
||||||
|
updateFanStatistics,
|
||||||
|
exportFanStatistics,
|
||||||
|
getWxByUserId,
|
||||||
|
} from "@/api/custom/fanStatistics";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import { mapState } from "vuex";
|
||||||
const loginUserId = store.getters && store.getters.userId;
|
const loginUserId = store.getters && store.getters.userId;
|
||||||
const nowDate = dayjs().subtract(1, 'day').format("YYYY-MM-DD");
|
const nowDate = dayjs().subtract(1, "day").format("YYYY-MM-DD");
|
||||||
export default {
|
export default {
|
||||||
name: "FanStatistics",
|
name: "FanStatistics",
|
||||||
data() {
|
data() {
|
||||||
@ -229,20 +319,18 @@
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
fanTime: nowDate,
|
fanTime: nowDate,
|
||||||
userId: null,
|
userId: null,
|
||||||
accountId: null
|
accountId: null,
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
|
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
|
||||||
userId: [{ required: true, trigger: "blur", message: "请选择销售" }]
|
userId: [{ required: true, trigger: "blur", message: "请选择销售" }],
|
||||||
},
|
},
|
||||||
showWxFlag: false,
|
showWxFlag: false,
|
||||||
//当前选择的用户被分配的微信号
|
//当前选择的用户被分配的微信号
|
||||||
wxList: [],
|
wxList: [],
|
||||||
//销售列表
|
|
||||||
preSaleIdOptions:[],
|
|
||||||
//进粉渠道列表
|
//进粉渠道列表
|
||||||
accountIdOptions: [],
|
accountIdOptions: [],
|
||||||
editOpen: false,
|
editOpen: false,
|
||||||
@ -250,25 +338,35 @@
|
|||||||
// 表单校验
|
// 表单校验
|
||||||
editRules: {
|
editRules: {
|
||||||
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
|
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
|
||||||
fanNum: [{ required: true, trigger: "blur", message: "请输入进粉数量" }],
|
fanNum: [
|
||||||
|
{ required: true, trigger: "blur", message: "请输入进粉数量" },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getSaleUserList();
|
|
||||||
this.getDicts("fan_channel").then((response) => {
|
this.getDicts("fan_channel").then((response) => {
|
||||||
this.accountIdOptions = response.data;
|
this.accountIdOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
//销售列表
|
||||||
|
preSaleIdOptions: (state) => state.global.preSaleIdOptions.slice(1),
|
||||||
|
}),
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询进粉统计列表 */
|
/** 查询进粉统计列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listFanStatistics(this.queryParams).then(response => {
|
listFanStatistics(this.queryParams).then((response) => {
|
||||||
this.fanStatisticsList = response.rows;
|
this.fanStatisticsList = response.rows;
|
||||||
this.totalFanNum = 0;
|
this.totalFanNum = 0;
|
||||||
if(this.fanStatisticsList != null && this.fanStatisticsList.length > 0){
|
if (
|
||||||
|
this.fanStatisticsList != null &&
|
||||||
|
this.fanStatisticsList.length > 0
|
||||||
|
) {
|
||||||
this.totalFanNum = this.fanStatisticsList[0].totalFanNum;
|
this.totalFanNum = this.fanStatisticsList[0].totalFanNum;
|
||||||
}
|
}
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
@ -291,7 +389,7 @@
|
|||||||
userId: null,
|
userId: null,
|
||||||
fanTime: nowDate,
|
fanTime: nowDate,
|
||||||
wxId: [],
|
wxId: [],
|
||||||
fanNum: []
|
fanNum: [],
|
||||||
};
|
};
|
||||||
this.wxList = [];
|
this.wxList = [];
|
||||||
this.showWxFlag = false;
|
this.showWxFlag = false;
|
||||||
@ -302,7 +400,7 @@
|
|||||||
id: null,
|
id: null,
|
||||||
wxId: null,
|
wxId: null,
|
||||||
fanTime: null,
|
fanTime: null,
|
||||||
fanNum: 0
|
fanNum: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
@ -317,9 +415,9 @@
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map((item) => item.id);
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -337,8 +435,8 @@
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.editFormReset();
|
this.editFormReset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids;
|
||||||
getFanStatistics(id).then(response => {
|
getFanStatistics(id).then((response) => {
|
||||||
this.editForm.id = response.data.id;
|
this.editForm.id = response.data.id;
|
||||||
this.editForm.wxId = response.data.wxId;
|
this.editForm.wxId = response.data.wxId;
|
||||||
this.editForm.fanTime = response.data.fanTime;
|
this.editForm.fanTime = response.data.fanTime;
|
||||||
@ -346,12 +444,10 @@
|
|||||||
this.editOpen = true;
|
this.editOpen = true;
|
||||||
this.title = "修改「" + row.wxAccount + "」的进粉统计";
|
this.title = "修改「" + row.wxAccount + "」的进粉统计";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.wxId.length == 0) {
|
if (this.form.wxId.length == 0) {
|
||||||
this.msgError("该销售未被分配微信");
|
this.msgError("该销售未被分配微信");
|
||||||
@ -366,7 +462,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (flag) {
|
if (flag) {
|
||||||
addFanStatistics(this.form).then(response => {
|
addFanStatistics(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -381,9 +477,9 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
editSubmit() {
|
editSubmit() {
|
||||||
this.$refs["editForm"].validate(valid => {
|
this.$refs["editForm"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
updateFanStatistics(this.editForm).then(response => {
|
updateFanStatistics(this.editForm).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.editOpen = false;
|
this.editOpen = false;
|
||||||
@ -398,46 +494,39 @@
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
this.$confirm('是否确认删除进粉统计编号为"' + ids + '"的数据项?', "警告", {
|
this.$confirm(
|
||||||
|
'是否确认删除进粉统计编号为"' + ids + '"的数据项?',
|
||||||
|
"警告",
|
||||||
|
{
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function() {
|
}
|
||||||
|
)
|
||||||
|
.then(function () {
|
||||||
return delFanStatistics(ids);
|
return delFanStatistics(ids);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
}).catch(function() {});
|
})
|
||||||
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
this.$confirm('是否确认导出所有进粉统计数据项?', "警告", {
|
this.$confirm("是否确认导出所有进粉统计数据项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function() {
|
})
|
||||||
|
.then(function () {
|
||||||
return exportFanStatistics(queryParams);
|
return exportFanStatistics(queryParams);
|
||||||
}).then(response => {
|
})
|
||||||
|
.then((response) => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
}).catch(function() {});
|
})
|
||||||
},
|
.catch(function () {});
|
||||||
//获取销售用户列表
|
|
||||||
getSaleUserList(){
|
|
||||||
getOptions().then((response) => {
|
|
||||||
const options = response.data.reduce((opts, cur) => {
|
|
||||||
if (!opts[cur.postCode]) {
|
|
||||||
opts[cur.postCode] = [];
|
|
||||||
}
|
|
||||||
opts[cur.postCode].push({
|
|
||||||
dictValue: cur.userId,
|
|
||||||
dictLabel: cur.userName,
|
|
||||||
remark: cur.remark,
|
|
||||||
});
|
|
||||||
return opts;
|
|
||||||
}, {});
|
|
||||||
this.preSaleIdOptions = options["pre_sale"] || [];
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
//根据用户ID查询被分配的微信号
|
//根据用户ID查询被分配的微信号
|
||||||
getWxByUserId(userId) {
|
getWxByUserId(userId) {
|
||||||
@ -448,7 +537,7 @@
|
|||||||
if (userId == null || userId == undefined || userId == "") {
|
if (userId == null || userId == undefined || userId == "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getWxByUserId(userId).then(response => {
|
getWxByUserId(userId).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.wxList = response.data ? response.data : [];
|
this.wxList = response.data ? response.data : [];
|
||||||
if (this.wxList.length > 0) {
|
if (this.wxList.length > 0) {
|
||||||
@ -467,6 +556,6 @@
|
|||||||
"form.userId": function (newVal, oldVal) {
|
"form.userId": function (newVal, oldVal) {
|
||||||
this.getWxByUserId(newVal);
|
this.getWxByUserId(newVal);
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -335,7 +335,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
<el-table-column label="客户姓名" align="center" prop="customer" />
|
||||||
<el-table-column label="手机号" align="center" prop="phone" width="100" />
|
<!-- <el-table-column label="手机号" align="center" prop="phone" width="100" /> -->
|
||||||
<el-table-column label="成交金额" align="center" prop="amount">
|
<el-table-column label="成交金额" align="center" prop="amount">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ toThousands(scope.row.amount) }}
|
{{ toThousands(scope.row.amount) }}
|
||||||
@ -455,6 +455,7 @@ import orderPause from "./orderPause";
|
|||||||
import OrderDetail from "@/components/OrderDetail";
|
import OrderDetail from "@/components/OrderDetail";
|
||||||
import OrderEdit from "@/components/OrderEdit";
|
import OrderEdit from "@/components/OrderEdit";
|
||||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
|
||||||
const beginTime = dayjs().startOf("month").format("YYYY-MM-DD");
|
const beginTime = dayjs().startOf("month").format("YYYY-MM-DD");
|
||||||
const endTime = dayjs().format("YYYY-MM-DD");
|
const endTime = dayjs().format("YYYY-MM-DD");
|
||||||
@ -492,16 +493,6 @@ export default {
|
|||||||
daterange: [beginTime, endTime],
|
daterange: [beginTime, endTime],
|
||||||
// 收款方式字典
|
// 收款方式字典
|
||||||
payTypeIdOptions: [],
|
payTypeIdOptions: [],
|
||||||
// 售前字典
|
|
||||||
preSaleIdOptions: [],
|
|
||||||
// 售后字典
|
|
||||||
afterSaleIdOptions: [],
|
|
||||||
// 主营养师字典
|
|
||||||
nutritionistIdOptions: [],
|
|
||||||
// 助理营养师字典
|
|
||||||
nutriAssisIdOptions: [],
|
|
||||||
// 策划字典
|
|
||||||
plannerIdOptions: [],
|
|
||||||
// 账号
|
// 账号
|
||||||
accountIdOptions: [],
|
accountIdOptions: [],
|
||||||
// 服务时长
|
// 服务时长
|
||||||
@ -510,12 +501,6 @@ export default {
|
|||||||
conditioningProjectIdOption: [],
|
conditioningProjectIdOption: [],
|
||||||
// 审核状态
|
// 审核状态
|
||||||
reviewStatusOptions: [],
|
reviewStatusOptions: [],
|
||||||
// 策划助理字典
|
|
||||||
plannerAssisIdOptions: [],
|
|
||||||
// 运营字典
|
|
||||||
operatorIdOptions: [],
|
|
||||||
//
|
|
||||||
operatorAssisIdOptions: [],
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@ -539,32 +524,28 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
// 售前字典
|
||||||
|
"preSaleIdOptions",
|
||||||
|
// 售后字典
|
||||||
|
"afterSaleIdOptions",
|
||||||
|
// 主营养师字典
|
||||||
|
"nutritionistIdOptions",
|
||||||
|
// 助理营养师字典
|
||||||
|
"nutriAssisIdOptions",
|
||||||
|
// 策划字典
|
||||||
|
"plannerIdOptions",
|
||||||
|
// 策划助理字典
|
||||||
|
"plannerAssisIdOptions",
|
||||||
|
// 运营字典
|
||||||
|
"operatorIdOptions",
|
||||||
|
// 运营助理字典
|
||||||
|
"operatorAssisIdOptions",
|
||||||
|
]),
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
getOptions().then((response) => {
|
|
||||||
const options = response.data.reduce((opts, cur) => {
|
|
||||||
if (!opts[cur.postCode]) {
|
|
||||||
opts[cur.postCode] = [
|
|
||||||
// { dictValue: 0, dictLabel: "无", remark: null },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
opts[cur.postCode].push({
|
|
||||||
dictValue: cur.userId,
|
|
||||||
dictLabel: cur.userName,
|
|
||||||
remark: cur.remark,
|
|
||||||
});
|
|
||||||
return opts;
|
|
||||||
}, {});
|
|
||||||
this.preSaleIdOptions = options["pre_sale"] || [];
|
|
||||||
this.afterSaleIdOptions = options["after_sale"] || [];
|
|
||||||
this.nutritionistIdOptions = options["nutri"] || [];
|
|
||||||
this.nutriAssisIdOptions = options["nutri_assis"] || [];
|
|
||||||
this.plannerIdOptions = options["planner"] || [];
|
|
||||||
this.plannerAssisIdOptions = options["planner_assis"] || [];
|
|
||||||
this.operatorIdOptions = options["operator"] || [];
|
|
||||||
this.operatorAssisIdOptions = options["operator_assis"] || [];
|
|
||||||
});
|
|
||||||
this.getDicts("cus_pay_type").then((response) => {
|
this.getDicts("cus_pay_type").then((response) => {
|
||||||
this.payTypeIdOptions = response.data;
|
this.payTypeIdOptions = response.data;
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import TextInfo from "./TextInfo.vue";
|
import TextInfo from "@/components/TextInfo";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "BodySignView",
|
name: "BodySignView",
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import TextInfo from "./TextInfo.vue";
|
import TextInfo from "@/components/TextInfo";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "HealthyView",
|
name: "HealthyView",
|
||||||
@ -166,6 +166,7 @@ export default {
|
|||||||
{ title: "是否出现过过敏症状", value: "allergyFlag" },
|
{ title: "是否出现过过敏症状", value: "allergyFlag" },
|
||||||
{ title: "过敏症状", value: "allergySituation" },
|
{ title: "过敏症状", value: "allergySituation" },
|
||||||
{ title: "过敏源", value: "allergen" },
|
{ title: "过敏源", value: "allergen" },
|
||||||
|
{ title: "忌口过敏食物", value: "dishesIngredient" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<RecipesCom v-for="item in data" :key="item.id" :data="item" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import RecipesCom from "@/components/RecipesCom";
|
|
||||||
export default {
|
|
||||||
name: "RecipesView",
|
|
||||||
components: {
|
|
||||||
RecipesCom,
|
|
||||||
},
|
|
||||||
props: ["data"],
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<style rel="stylesheet/scss" lang="scss">
|
|
||||||
</style>
|
|
@ -0,0 +1,148 @@
|
|||||||
|
<template>
|
||||||
|
<div :class="className" :style="{ height: height, width: width }" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import echarts from "echarts";
|
||||||
|
require("@/utils/echarts/myShine");
|
||||||
|
import resize from "@/views/dashboard/mixins/resize";
|
||||||
|
|
||||||
|
const animationDuration = 6000;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mixins: [resize],
|
||||||
|
props: {
|
||||||
|
className: {
|
||||||
|
type: String,
|
||||||
|
default: "chart",
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: "100%",
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: "300px",
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
chart: null,
|
||||||
|
nameDict: {
|
||||||
|
pHeat: "蛋白质",
|
||||||
|
fHeat: "脂肪",
|
||||||
|
cHeat: "碳水",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.initChart();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (!this.chart) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.chart.dispose();
|
||||||
|
this.chart = null;
|
||||||
|
},
|
||||||
|
updated() {
|
||||||
|
// console.log("updated");
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initChart() {
|
||||||
|
this.chart = echarts.init(this.$el, "myShine");
|
||||||
|
this.updateChart(this.data.length > 0 ? this.data : {});
|
||||||
|
},
|
||||||
|
updateChart(source) {
|
||||||
|
this.chart.clear();
|
||||||
|
this.chart.setOption({
|
||||||
|
title: {
|
||||||
|
text: "营养统计",
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: "axis",
|
||||||
|
appendToBody: true,
|
||||||
|
formatter: (params) => {
|
||||||
|
// console.log(params);
|
||||||
|
const [param] = params;
|
||||||
|
const { name } = param;
|
||||||
|
let totalHeat = 0;
|
||||||
|
const tooltips = params.reduce(
|
||||||
|
(arr, cur) => {
|
||||||
|
const { value, seriesName } = cur;
|
||||||
|
const nutriName = this.nameDict[seriesName];
|
||||||
|
totalHeat += value[seriesName];
|
||||||
|
const heatVal = value[seriesName].toFixed(1);
|
||||||
|
const weightVal = value[
|
||||||
|
`${seriesName.substring(0, 1)}Weight`
|
||||||
|
].toFixed(1);
|
||||||
|
arr.push(
|
||||||
|
`${cur.marker} ${nutriName}:${heatVal}千卡(${weightVal}克)`
|
||||||
|
);
|
||||||
|
return arr;
|
||||||
|
},
|
||||||
|
[name]
|
||||||
|
);
|
||||||
|
tooltips[0] += ` - 共${totalHeat.toFixed(1)}千卡`;
|
||||||
|
return tooltips.join("</br>");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dataset: {
|
||||||
|
dimensions: [
|
||||||
|
"name",
|
||||||
|
"pWeight",
|
||||||
|
"pHeat",
|
||||||
|
"fWeight",
|
||||||
|
"fHeat",
|
||||||
|
"cWeight",
|
||||||
|
"cHeat",
|
||||||
|
],
|
||||||
|
source,
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
top: 40,
|
||||||
|
left: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 10,
|
||||||
|
containLabel: true,
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: "category",
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: "value",
|
||||||
|
},
|
||||||
|
series: ["pHeat", "fHeat", "cHeat"].map((dim, idx) => ({
|
||||||
|
name: dim,
|
||||||
|
type: "bar",
|
||||||
|
barWidth: 26,
|
||||||
|
stack: "bar",
|
||||||
|
encode: {
|
||||||
|
y: dim,
|
||||||
|
x: 0,
|
||||||
|
},
|
||||||
|
itemStyle: {
|
||||||
|
borderWidth: 2,
|
||||||
|
borderColor: "#fff",
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
data(newVal, oldVal) {
|
||||||
|
if (newVal) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.updateChart(newVal);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,202 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
:class="`aspect_pie_chart_wrapper ${className || ''}`"
|
||||||
|
:style="{ height: height, width: width }"
|
||||||
|
>
|
||||||
|
<div ref="echart" :style="{ height: height, width: '200px' }" />
|
||||||
|
<div>
|
||||||
|
<el-table
|
||||||
|
:data="mData"
|
||||||
|
size="mini"
|
||||||
|
border
|
||||||
|
:cell-style="{ padding: '2px 0' }"
|
||||||
|
:header-cell-style="{ padding: '4px 0', height: 'unset' }"
|
||||||
|
class="small_table"
|
||||||
|
>
|
||||||
|
<el-table-column label="营养" prop="type" align="center" width="60" />
|
||||||
|
<el-table-column
|
||||||
|
label="重量(g)"
|
||||||
|
prop="weight"
|
||||||
|
align="center"
|
||||||
|
width="80"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="热量(Kcal)"
|
||||||
|
prop="heat"
|
||||||
|
align="center"
|
||||||
|
width="90"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="热量占比"
|
||||||
|
prop="heatRate"
|
||||||
|
align="center"
|
||||||
|
width="80"
|
||||||
|
/>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import echarts from "echarts";
|
||||||
|
require("@/utils/echarts/myShine");
|
||||||
|
import resize from "@/views/dashboard/mixins/resize";
|
||||||
|
import TextInfo from "@/components/TextInfo";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mixins: [resize],
|
||||||
|
components: {
|
||||||
|
TextInfo,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
className: {
|
||||||
|
type: String,
|
||||||
|
default: "chart",
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: "100%",
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: "300px",
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
chart: null,
|
||||||
|
nameDict: {
|
||||||
|
p: "蛋白质",
|
||||||
|
f: "脂肪",
|
||||||
|
c: "碳水",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
mData() {
|
||||||
|
const [data] = this.data;
|
||||||
|
let totalHeat = 0;
|
||||||
|
return data
|
||||||
|
? ["p", "f", "c"].map((type) => {
|
||||||
|
if (totalHeat === 0) {
|
||||||
|
totalHeat = ["p", "f", "c"].reduce((heat, cur) => {
|
||||||
|
heat += data[`${cur}Heat`];
|
||||||
|
return heat;
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
type: this.nameDict[type],
|
||||||
|
weight: data[`${type}Weight`].toFixed(1),
|
||||||
|
heat: data[`${type}Heat`].toFixed(1),
|
||||||
|
heatRate: `${((data[`${type}Heat`] / totalHeat) * 100).toFixed(
|
||||||
|
2
|
||||||
|
)}%`,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.initChart();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (!this.chart) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.chart.dispose();
|
||||||
|
this.chart = null;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initChart() {
|
||||||
|
this.chart = echarts.init(this.$refs.echart, "myShine");
|
||||||
|
this.updateChart(this.data.length > 0 ? this.data[0] : {});
|
||||||
|
},
|
||||||
|
updateChart(data) {
|
||||||
|
this.chart.clear();
|
||||||
|
this.chart.setOption({
|
||||||
|
title: {
|
||||||
|
text: `${data.name}营养统计`,
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: "item",
|
||||||
|
appendToBody: true,
|
||||||
|
formatter: (params) => {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
marker,
|
||||||
|
percent,
|
||||||
|
data: { value, oriData, dim },
|
||||||
|
} = params;
|
||||||
|
return [
|
||||||
|
`${marker} ${name}`,
|
||||||
|
`含量:${oriData[`${dim}Weight`].toFixed(1)}克`,
|
||||||
|
`热量:${value.toFixed(1)}千卡`,
|
||||||
|
`热量占比:${percent}%`,
|
||||||
|
].join("</br>");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: data.name,
|
||||||
|
type: "pie",
|
||||||
|
radius: [0, 50],
|
||||||
|
center: ["50%", "50%"],
|
||||||
|
data: ["p", "f", "c"].map((dim) => ({
|
||||||
|
dim,
|
||||||
|
value: data[`${dim}Heat`],
|
||||||
|
name: this.nameDict[dim],
|
||||||
|
oriData: data,
|
||||||
|
})),
|
||||||
|
labelLine: {
|
||||||
|
length: 5,
|
||||||
|
length2: 5,
|
||||||
|
},
|
||||||
|
// label: {
|
||||||
|
// show: true,
|
||||||
|
// position: "inside",
|
||||||
|
// color: '#fff'
|
||||||
|
// },
|
||||||
|
itemStyle: {
|
||||||
|
borderWidth: 1,
|
||||||
|
borderColor: "#fff",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
data(newVal, oldVal) {
|
||||||
|
if (newVal) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.updateChart(newVal[0]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.aspect_pie_chart_wrapper {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
& > div:nth-child(1) {
|
||||||
|
// width: 200px
|
||||||
|
}
|
||||||
|
|
||||||
|
// & > div:nth-child(2) {
|
||||||
|
.small_table {
|
||||||
|
.my_cell {
|
||||||
|
padding: 2px 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,82 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="recipes_aspect_wrapper"
|
||||||
|
:style="`height: ${collapse ? 30 : 200}px`"
|
||||||
|
>
|
||||||
|
<div class="header">
|
||||||
|
<el-button
|
||||||
|
v-if="!recipesId"
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
@click="handleOnSave"
|
||||||
|
>生成食谱</el-button
|
||||||
|
>
|
||||||
|
<el-button size="mini" type="text" @click="handleCollapseClick">{{
|
||||||
|
`${collapse ? "展开分析" : "收起分析"}`
|
||||||
|
}}</el-button>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="content"
|
||||||
|
:style="`visibility: ${collapse ? 'hidden' : 'visible'};`"
|
||||||
|
>
|
||||||
|
<BarChart
|
||||||
|
v-if="data.length > 1"
|
||||||
|
:data="data"
|
||||||
|
height="170px"
|
||||||
|
width="500px"
|
||||||
|
/>
|
||||||
|
<PieChart
|
||||||
|
v-if="data.length === 1"
|
||||||
|
:data="data"
|
||||||
|
height="170px"
|
||||||
|
width="500px"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import BarChart from "./BarChart";
|
||||||
|
import PieChart from "./PieChart";
|
||||||
|
import { createNamespacedHelpers } from "vuex";
|
||||||
|
const { mapActions, mapState } = createNamespacedHelpers("recipes");
|
||||||
|
export default {
|
||||||
|
name: "RecipesAspectCom",
|
||||||
|
components: {
|
||||||
|
BarChart,
|
||||||
|
PieChart,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
updated() {
|
||||||
|
// console.log(this.data);
|
||||||
|
},
|
||||||
|
props: ["collapse", "data"],
|
||||||
|
computed: {
|
||||||
|
...mapState(["recipesId"]),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleCollapseClick() {
|
||||||
|
this.$emit("update:collapse", !this.collapse);
|
||||||
|
},
|
||||||
|
handleOnSave() {
|
||||||
|
this.saveRecipes();
|
||||||
|
},
|
||||||
|
...mapActions(["saveRecipes"]),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scope>
|
||||||
|
.recipes_aspect_wrapper {
|
||||||
|
transition: all 0.3s;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
text-align: right;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,165 @@
|
|||||||
|
<template>
|
||||||
|
<el-form>
|
||||||
|
<el-form-item label="菜品名">
|
||||||
|
<span style="color: #262626; font-size: 16px; font-weight: bold">{{
|
||||||
|
name
|
||||||
|
}}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="菜品类型">
|
||||||
|
<el-radio-group v-model="type" @change="handleOnTypeChange">
|
||||||
|
<el-radio
|
||||||
|
v-for="item in typeOptions"
|
||||||
|
:key="item.dictValue"
|
||||||
|
:label="item.dictValue"
|
||||||
|
>{{ item.dictLabel }}</el-radio
|
||||||
|
>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="食材分量">
|
||||||
|
<el-table
|
||||||
|
:data="igdList"
|
||||||
|
border
|
||||||
|
show-summary
|
||||||
|
size="mini"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
>
|
||||||
|
<el-table-column prop="name" label="食材" align="center" />
|
||||||
|
<el-table-column label="分量估算" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<EditableUnit
|
||||||
|
:weight="scope.row.cusWeight"
|
||||||
|
:unit="scope.row.cusUnit"
|
||||||
|
@onChange="(val) => handleOnCustomUnitChange(scope.row, val)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="weight" label="重量(g)" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<EditableText
|
||||||
|
:value="scope.row.weight"
|
||||||
|
@onChange="(val) => handleOnWeightChange(scope.row, val)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="proteinRatio"
|
||||||
|
label="P/100g"
|
||||||
|
align="center"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="fatRatio" label="F/100g" align="center" />
|
||||||
|
<el-table-column prop="carbonRatio" label="C/100g" align="center" />
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="推荐人群">
|
||||||
|
<el-tag
|
||||||
|
style="margin-right: 4px"
|
||||||
|
v-for="rec in recTags"
|
||||||
|
:key="rec"
|
||||||
|
type="success"
|
||||||
|
>
|
||||||
|
{{ rec }}
|
||||||
|
</el-tag>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="忌口人群">
|
||||||
|
<el-tag
|
||||||
|
style="margin-right: 4px"
|
||||||
|
v-for="notRec in notRecTags"
|
||||||
|
:key="notRec"
|
||||||
|
type="danger"
|
||||||
|
>
|
||||||
|
{{ notRec }}
|
||||||
|
</el-tag>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import produce from "immer";
|
||||||
|
import EditableText from "../EditableText";
|
||||||
|
import EditableUnit from "../EditableUnit";
|
||||||
|
export default {
|
||||||
|
name: "ConfigDishes",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
nType: this.type,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
igdList: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
notRecTags: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
recTags: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
EditableText,
|
||||||
|
EditableUnit,
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {
|
||||||
|
handleOnTypeChange(type) {
|
||||||
|
this.$emit("onChane", { type });
|
||||||
|
},
|
||||||
|
handleOnWeightChange(data, val) {
|
||||||
|
// console.log({ data, val });
|
||||||
|
this.$emit("onChane", {
|
||||||
|
igdList: produce(this.igdList, (draftState) => {
|
||||||
|
const tarIgd = draftState.find((obj) => obj.id === data.id);
|
||||||
|
if (tarIgd) {
|
||||||
|
tarIgd.weight = val;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleOnCustomUnitChange(data, val) {
|
||||||
|
// console.log({ data, val });
|
||||||
|
this.$emit("onChane", {
|
||||||
|
igdList: produce(this.igdList, (draftState) => {
|
||||||
|
const tarIgd = draftState.find((obj) => obj.id === data.id);
|
||||||
|
if (tarIgd) {
|
||||||
|
tarIgd.cusWeight = val.cusWeight;
|
||||||
|
tarIgd.cusUnit = val.cusUnit;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getSummaries(param) {
|
||||||
|
const { columns, data } = param;
|
||||||
|
return columns.reduce(
|
||||||
|
(arr, cur, idx) => {
|
||||||
|
if (idx > 1) {
|
||||||
|
arr[idx] = data.reduce((acc, dAcc) => {
|
||||||
|
if (idx === 2) {
|
||||||
|
return acc + parseFloat(dAcc.weight);
|
||||||
|
}
|
||||||
|
return parseFloat(
|
||||||
|
(acc + (dAcc[cur.property] * dAcc.weight) / 100).toFixed(1)
|
||||||
|
);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
},
|
||||||
|
["合计"]
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,172 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="菜品名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入菜品名称"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="菜品类型" prop="type">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
placeholder="请选择菜品类型"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in typeOptions"
|
||||||
|
: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-table
|
||||||
|
v-loading="loading"
|
||||||
|
size="mini"
|
||||||
|
:data="dishesList"
|
||||||
|
height="600"
|
||||||
|
highlight-current-row
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
>
|
||||||
|
<el-table-column label="菜品名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="菜品类型" align="center" prop="type">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<AutoHideInfo :data="typeFormat(scope.row)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="包含食材" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div v-for="igd in scope.row.igdList" :key="igd.id">
|
||||||
|
{{ igd.name }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="推荐人群" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<AutoHideInfo :data="scope.row.recTags" :line="0" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="忌口人群" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<AutoHideInfo :data="scope.row.notRecTags" :line="0" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
layout="total, prev, pager, next"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import AutoHideInfo from "@/components/AutoHideInfo";
|
||||||
|
import { listDishes } from "@/api/custom/dishes";
|
||||||
|
import { createNamespacedHelpers } from "vuex";
|
||||||
|
const { mapState } = createNamespacedHelpers("recipes");
|
||||||
|
export default {
|
||||||
|
name: "SelectDishes",
|
||||||
|
props: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
total: 0,
|
||||||
|
dishesList: [],
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
type: null,
|
||||||
|
reviewStatus: "yes",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
AutoHideInfo,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["typeOptions"]),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
// console.log('getList')
|
||||||
|
this.loading = true;
|
||||||
|
listDishes(this.queryParams).then((result) => {
|
||||||
|
this.dishesList = result.rows.map((d) => {
|
||||||
|
const recTags = [],
|
||||||
|
notRecTags = [];
|
||||||
|
d.igdList.forEach((igd) => {
|
||||||
|
if (igd.rec) {
|
||||||
|
igd.rec.split(",").forEach((rec) => {
|
||||||
|
if (!recTags.includes(rec)) {
|
||||||
|
recTags.push(rec);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (igd.notRec) {
|
||||||
|
igd.notRec.split(",").forEach((notRec) => {
|
||||||
|
if (!notRecTags.includes(notRec)) {
|
||||||
|
notRecTags.push(notRec);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
...d,
|
||||||
|
recTags,
|
||||||
|
notRecTags,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this.total = result.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCurrentChange(data) {
|
||||||
|
this.$emit("onChange", data);
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
typeFormat(row, column) {
|
||||||
|
return !row.type
|
||||||
|
? ""
|
||||||
|
: row.type
|
||||||
|
.split(",")
|
||||||
|
.map((type) => this.selectDictLabel(this.typeOptions, type));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,185 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
title="添加菜品"
|
||||||
|
:visible.sync="visible"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:before-close="handleOnClosed"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
class="add_dishes_drawer_wrapper"
|
||||||
|
direction="ltr"
|
||||||
|
size="40%"
|
||||||
|
>
|
||||||
|
<div class="content_wrapper">
|
||||||
|
<div class="content_detail">
|
||||||
|
<el-steps :active="active" style="margin-bottom: 20px">
|
||||||
|
<el-step title="选择菜品" />
|
||||||
|
<el-step title="配置菜品" />
|
||||||
|
</el-steps>
|
||||||
|
|
||||||
|
<SelectDishes
|
||||||
|
ref="dishesRef"
|
||||||
|
v-show="active === 0"
|
||||||
|
@onChange="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
<ConfigDishes
|
||||||
|
v-show="active === 1"
|
||||||
|
v-bind="selDishes"
|
||||||
|
:typeOptions="typeOptions"
|
||||||
|
@onChange="handleOnConfigChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
v-show="active === 1"
|
||||||
|
type="info"
|
||||||
|
@click="handleOnLastStepClick"
|
||||||
|
>上一步</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
v-show="active === 1"
|
||||||
|
type="primary"
|
||||||
|
@click="handleOnConfirmClick"
|
||||||
|
>确 定</el-button
|
||||||
|
>
|
||||||
|
<el-button size="small" @click="handleOnCancelClick">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { createNamespacedHelpers } from "vuex";
|
||||||
|
const { mapState } = createNamespacedHelpers("recipes");
|
||||||
|
|
||||||
|
import SelectDishes from "./SelectDishes";
|
||||||
|
import ConfigDishes from "./ConfigDishes";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "AddDishesDrawer",
|
||||||
|
components: {
|
||||||
|
SelectDishes,
|
||||||
|
ConfigDishes,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
active: 0,
|
||||||
|
typeOptions: [],
|
||||||
|
selDishes: {
|
||||||
|
name: "",
|
||||||
|
type: "",
|
||||||
|
igdList: [],
|
||||||
|
recTags: [],
|
||||||
|
notRecTags: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["dishesTypeOptions"]),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showDrawer() {
|
||||||
|
this.visible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.dishesRef.getList();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleOnClosed(done) {
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
handleCurrentChange(data) {
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// console.log(data);
|
||||||
|
this.selDishes = data;
|
||||||
|
this.active = 1;
|
||||||
|
this.typeOptions = data.type.split(",").reduce((arr, cur, idx) => {
|
||||||
|
if (idx === 0) {
|
||||||
|
this.selDishes.type = cur;
|
||||||
|
}
|
||||||
|
const tarOpt = this.dishesTypeOptions.find(
|
||||||
|
(obj) => obj.dictValue === cur
|
||||||
|
);
|
||||||
|
if (tarOpt) {
|
||||||
|
arr.push(tarOpt);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
|
},
|
||||||
|
handleOnConfigChange(val) {
|
||||||
|
Object.keys(val).forEach((key) => {
|
||||||
|
this.selDishes[key] = val[key];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleOnCancelClick() {
|
||||||
|
this.visible = false;
|
||||||
|
this.active = 0;
|
||||||
|
},
|
||||||
|
handleOnLastStepClick() {
|
||||||
|
this.active = 0;
|
||||||
|
},
|
||||||
|
handleOnConfirmClick() {
|
||||||
|
this.visible = false;
|
||||||
|
this.active = 0;
|
||||||
|
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
methods,
|
||||||
|
name,
|
||||||
|
notRecTags,
|
||||||
|
recTags,
|
||||||
|
type,
|
||||||
|
igdList,
|
||||||
|
} = this.selDishes;
|
||||||
|
this.$emit("onConfirm", {
|
||||||
|
id: -1,
|
||||||
|
dishesId: id,
|
||||||
|
methods,
|
||||||
|
name,
|
||||||
|
notRecTags,
|
||||||
|
recTags,
|
||||||
|
type,
|
||||||
|
igdList,
|
||||||
|
});
|
||||||
|
// console.log(this.selDishes);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/deep/ :focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
.add_dishes_drawer_wrapper {
|
||||||
|
.content_wrapper {
|
||||||
|
padding: 16px 20px;
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.content_detail {
|
||||||
|
flex: 1 1 0;
|
||||||
|
padding: 12px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
flex: 0 0 45px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding: 0 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="scss">
|
||||||
|
.add_dishes_drawer_wrapper {
|
||||||
|
#el-drawer__title {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,69 @@
|
|||||||
|
<template>
|
||||||
|
<div class="editable_text_wrapper">
|
||||||
|
<div class="value" v-if="!editing" @click="handleOnClick">{{ value }}</div>
|
||||||
|
<input
|
||||||
|
v-else
|
||||||
|
class="input"
|
||||||
|
ref="inputRef"
|
||||||
|
type="number"
|
||||||
|
:step="5"
|
||||||
|
:value="value"
|
||||||
|
@blur="handleOnBlur"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "EditableText",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editing: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: ["value"],
|
||||||
|
methods: {
|
||||||
|
handleOnClick(e) {
|
||||||
|
if (!this.editing) {
|
||||||
|
this.editing = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["inputRef"].focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleOnBlur(e) {
|
||||||
|
const { value } = e.target;
|
||||||
|
if (value > 0) {
|
||||||
|
this.editing = false;
|
||||||
|
const mValue = parseFloat(value)
|
||||||
|
if (mValue !== parseFloat(this.value)) {
|
||||||
|
this.$emit("onChange", mValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message.error("数字必须大于0");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.editable_text_wrapper {
|
||||||
|
.value {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
width: 96%;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #409eff;
|
||||||
|
}
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #409eff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,147 @@
|
|||||||
|
<template>
|
||||||
|
<div class="editable_unit_wrapper">
|
||||||
|
<div class="value" v-if="!editing" @click="handleOnClick">
|
||||||
|
<span>{{ unitWeight }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="selector">
|
||||||
|
<select
|
||||||
|
:value="mWeight"
|
||||||
|
@click="handleOnSelectClick"
|
||||||
|
@change="handleOnWeightChange"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="item in cusWeightOptions"
|
||||||
|
:key="item.dictValue"
|
||||||
|
:value="item.dictValue"
|
||||||
|
>
|
||||||
|
{{ item.dictLabel }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<select
|
||||||
|
:value="mUnit"
|
||||||
|
@click="handleOnSelectClick"
|
||||||
|
@change="handleOnUnitChange"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="item in cusUnitOptions"
|
||||||
|
:key="item.dictValue"
|
||||||
|
:value="item.dictValue"
|
||||||
|
>
|
||||||
|
{{ item.dictLabel }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { createNamespacedHelpers } from "vuex";
|
||||||
|
const { mapState, mapGetters } = createNamespacedHelpers("recipes");
|
||||||
|
export default {
|
||||||
|
name: "EditableUnit",
|
||||||
|
props: ["weight", "unit"],
|
||||||
|
mounted() {
|
||||||
|
window.addEventListener("click", this.handleOnWindowClick);
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
window.removeEventListener("click", this.handleOnWindowClick);
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editing: false,
|
||||||
|
mWeight: this.weight,
|
||||||
|
mUnit: this.unit,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleOnClick(e) {
|
||||||
|
if (!this.editing) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.editing = true;
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleOnWindowClick(e) {
|
||||||
|
if (this.editing) {
|
||||||
|
// console.log("handleOnWindowClick");
|
||||||
|
this.editing = false;
|
||||||
|
if (
|
||||||
|
String(this.mWeight) !== String(this.weight) ||
|
||||||
|
String(this.mUnit) !== String(this.unit)
|
||||||
|
) {
|
||||||
|
// console.log({
|
||||||
|
// mWeight: this.mWeight,
|
||||||
|
// mUnit: this.mUnit,
|
||||||
|
// weight: this.weight,
|
||||||
|
// unit: this.unit,
|
||||||
|
// });
|
||||||
|
this.$emit("onChange", {
|
||||||
|
cusWeight: this.mWeight,
|
||||||
|
cusUnit: this.mUnit,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleOnSelectClick(e) {
|
||||||
|
if (this.editing) {
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleOnWeightChange(e) {
|
||||||
|
const { value } = e.target;
|
||||||
|
this.mWeight = value;
|
||||||
|
},
|
||||||
|
handleOnUnitChange(e) {
|
||||||
|
const { value } = e.target;
|
||||||
|
this.mUnit = value;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
unitWeight() {
|
||||||
|
return (
|
||||||
|
`${this.cusWeightDict[this.mWeight] || ""}${
|
||||||
|
this.cusUnitDict[this.mUnit] || ""
|
||||||
|
}` || "_"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
...mapState(["cusUnitOptions", "cusWeightOptions"]),
|
||||||
|
...mapGetters(["cusUnitDict", "cusWeightDict"]),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.editable_unit_wrapper {
|
||||||
|
.value {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.selector {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
select:nth-child(1) {
|
||||||
|
margin-right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
font-size: 11px;
|
||||||
|
border: solid 1px #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
padding: 3px 6px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #409eff;
|
||||||
|
}
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #409eff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*清除ie的默认选择框样式清除,隐藏下拉箭头*/
|
||||||
|
select::-ms-expand {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,326 @@
|
|||||||
|
<template>
|
||||||
|
<div class="recipes_com_wrapper">
|
||||||
|
<el-table
|
||||||
|
:data="mData"
|
||||||
|
border
|
||||||
|
:span-method="spanMethod"
|
||||||
|
:cell-style="{ padding: '2px 0' }"
|
||||||
|
:header-cell-style="{ padding: '4px 0', height: 'unset' }"
|
||||||
|
size="mini"
|
||||||
|
:style="`outline: ${
|
||||||
|
currentDay + 1 === num ? '1px solid #d96969' : 'none'
|
||||||
|
}`"
|
||||||
|
>
|
||||||
|
<el-table-column prop="type" :width="100" align="center">
|
||||||
|
<template slot="header">
|
||||||
|
<span class="num_day" @click="handleOnOneDayAnalysis">{{
|
||||||
|
`${name}第${num}天`
|
||||||
|
}}</span>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="font-weight: bold; font-size: 14px">{{
|
||||||
|
typeFormatter(scope.row)
|
||||||
|
}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="菜品" prop="name" align="center">
|
||||||
|
<template slot="header">
|
||||||
|
<el-tooltip
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
content="点击添加菜品"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<span class="num_day" @click="handleOnAdd">菜品</span>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-popover placement="right" trigger="hover">
|
||||||
|
<div>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
size="mini"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
class="fun_button"
|
||||||
|
@click="handleOnDelete(scope.row)"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<span class="num_day" slot="reference">{{ scope.row.name }}</span>
|
||||||
|
</el-popover>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="食材" prop="igdName" align="center" />
|
||||||
|
<el-table-column label="分量估算" :width="80" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<EditableUnit
|
||||||
|
:weight="scope.row.cusWeight"
|
||||||
|
:unit="scope.row.cusUnit"
|
||||||
|
@onChange="(val) => handleOnCustomUnitChange(scope.row, val)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="重量(g)" prop="weight" :width="80" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<EditableText
|
||||||
|
:value="scope.row.weight"
|
||||||
|
@onChange="(val) => handleOnWeightChange(scope.row, val)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="蛋白质/100g"
|
||||||
|
prop="proteinRatio"
|
||||||
|
:width="100"
|
||||||
|
align="center"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="脂肪/100g"
|
||||||
|
prop="fatRatio"
|
||||||
|
:width="90"
|
||||||
|
align="center"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="碳水/100g"
|
||||||
|
prop="carbonRatio"
|
||||||
|
:width="90"
|
||||||
|
align="center"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="蛋白质含量"
|
||||||
|
prop="proteinRatio"
|
||||||
|
:width="90"
|
||||||
|
align="center"
|
||||||
|
:formatter="nutriFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="脂肪含量"
|
||||||
|
prop="fatRatio"
|
||||||
|
:width="90"
|
||||||
|
align="center"
|
||||||
|
:formatter="nutriFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="碳水含量"
|
||||||
|
prop="carbonRatio"
|
||||||
|
:width="90"
|
||||||
|
align="center"
|
||||||
|
:formatter="nutriFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column label="做法" prop="methods" />
|
||||||
|
</el-table>
|
||||||
|
<AddDishesDrawer ref="drawerRef" @onConfirm="handleOnDishesConfirm" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { createNamespacedHelpers } from "vuex";
|
||||||
|
const {
|
||||||
|
mapActions,
|
||||||
|
mapGetters,
|
||||||
|
mapState,
|
||||||
|
mapMutations,
|
||||||
|
} = createNamespacedHelpers("recipes");
|
||||||
|
|
||||||
|
import EditableText from "./EditableText";
|
||||||
|
import EditableUnit from "./EditableUnit";
|
||||||
|
import AddDishesDrawer from "./AddDishesDrawer";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "RecipesCom",
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: [],
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
num: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
EditableText,
|
||||||
|
EditableUnit,
|
||||||
|
AddDishesDrawer,
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// console.log(this.data);
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
mData() {
|
||||||
|
if (!this.data.dishes) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const mData = this.data.dishes
|
||||||
|
.sort((a, b) => a.type - b.type)
|
||||||
|
.reduce((arr, cur, idx) => {
|
||||||
|
if (cur.dishesId > 0 && cur.type !== "0") {
|
||||||
|
cur.igdList.forEach((igd) => {
|
||||||
|
let lastTypeHit = false,
|
||||||
|
lastNameHit = false;
|
||||||
|
if (arr.length > 0) {
|
||||||
|
// 倒推,找到第一个出现的位置
|
||||||
|
lastTypeHit = arr[arr.length - 1].type === cur.type;
|
||||||
|
if (lastTypeHit) {
|
||||||
|
let typePos = arr.length - 1;
|
||||||
|
for (let i = typePos; i >= 0; i--) {
|
||||||
|
if (arr[i].type !== cur.type) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
typePos = i;
|
||||||
|
}
|
||||||
|
arr[typePos].typeSpan.rowspan += 1;
|
||||||
|
}
|
||||||
|
lastNameHit = arr[arr.length - 1].name === cur.name;
|
||||||
|
if (lastNameHit) {
|
||||||
|
let namePos = arr.length - 1;
|
||||||
|
for (let i = namePos; i >= 0; i--) {
|
||||||
|
if (arr[i].name !== cur.name) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
namePos = i;
|
||||||
|
}
|
||||||
|
arr[namePos].nameSpan.rowspan += 1;
|
||||||
|
arr[namePos].methodsSpan.rowspan += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
arr.push({
|
||||||
|
id: cur.id,
|
||||||
|
dishesId: cur.dishesId,
|
||||||
|
menuId: cur.menuId,
|
||||||
|
name: cur.name,
|
||||||
|
type: cur.type,
|
||||||
|
isMain: cur.isMain,
|
||||||
|
methods: cur.methods,
|
||||||
|
igdId: igd.id,
|
||||||
|
igdName: igd.name,
|
||||||
|
proteinRatio: igd.proteinRatio,
|
||||||
|
fatRatio: igd.fatRatio,
|
||||||
|
carbonRatio: igd.carbonRatio,
|
||||||
|
rec: igd.rec,
|
||||||
|
notRec: igd.notRec,
|
||||||
|
weight: igd.weight,
|
||||||
|
cusWeight: igd.cusWeight,
|
||||||
|
cusUnit: igd.cusUnit,
|
||||||
|
typeSpan: lastTypeHit
|
||||||
|
? {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
rowspan: 1,
|
||||||
|
colspan: 1,
|
||||||
|
},
|
||||||
|
nameSpan: lastNameHit
|
||||||
|
? {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
rowspan: 1,
|
||||||
|
colspan: 1,
|
||||||
|
},
|
||||||
|
methodsSpan: lastNameHit
|
||||||
|
? {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
rowspan: 1,
|
||||||
|
colspan: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
|
// console.log(mData);
|
||||||
|
return mData;
|
||||||
|
},
|
||||||
|
...mapGetters(["typeDict"]),
|
||||||
|
...mapState(["currentDay"]),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
spanMethod({ row, column, rowIndex, columnIndex }) {
|
||||||
|
if (columnIndex === 0) {
|
||||||
|
return row.typeSpan;
|
||||||
|
} else if (columnIndex === 1) {
|
||||||
|
return row.nameSpan;
|
||||||
|
} else if (columnIndex === 11) {
|
||||||
|
return row.methodsSpan;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
typeFormatter(row) {
|
||||||
|
return this.typeDict[row.type];
|
||||||
|
},
|
||||||
|
nutriFormatter(row, col) {
|
||||||
|
return ((row.weight / 100) * row[col.property]).toFixed(1);
|
||||||
|
},
|
||||||
|
handleOnOneDayAnalysis(e) {
|
||||||
|
// 校验某天
|
||||||
|
this.setCurrentDay({ currentDay: this.num - 1 });
|
||||||
|
},
|
||||||
|
handleOnAdd() {
|
||||||
|
// console.log(this.num);
|
||||||
|
this.$refs.drawerRef.showDrawer();
|
||||||
|
},
|
||||||
|
handleOnDelete(data) {
|
||||||
|
// console.log(data);
|
||||||
|
this.deleteDishes({ num: this.num - 1, id: data.id });
|
||||||
|
},
|
||||||
|
handleOnWeightChange(data, weight) {
|
||||||
|
// console.log({ data, weight });
|
||||||
|
this.updateDishes({
|
||||||
|
num: this.num - 1,
|
||||||
|
dishesId: data.dishesId,
|
||||||
|
igdId: data.igdId,
|
||||||
|
weight,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleOnCustomUnitChange(data, { cusWeight, cusUnit }) {
|
||||||
|
// console.log({ data, cusWeight, cusUnit });
|
||||||
|
this.updateDishes({
|
||||||
|
num: this.num - 1,
|
||||||
|
dishesId: data.dishesId,
|
||||||
|
igdId: data.igdId,
|
||||||
|
cusWeight,
|
||||||
|
cusUnit,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleOnDishesConfirm(data) {
|
||||||
|
// console.log(data);
|
||||||
|
this.addDishes({
|
||||||
|
num: this.num - 1,
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
...mapActions(["updateDishes", "addDishes", "deleteDishes"]),
|
||||||
|
...mapMutations(["setCurrentDay"]),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.recipes_com_wrapper {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding: 1px;
|
||||||
|
|
||||||
|
.num_day {
|
||||||
|
cursor: pointer;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="scss">
|
||||||
|
.fun_button {
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<div class="recipes_view_wrapper">
|
||||||
|
<RecipesAspectCom :collapse.sync="collapse" :data="analyseData" />
|
||||||
|
<div
|
||||||
|
class="recipes_content"
|
||||||
|
:style="`height: calc(100vh - ${collapse ? 142 : 312}px)`"
|
||||||
|
>
|
||||||
|
<RecipesCom
|
||||||
|
v-for="(item, index) in data"
|
||||||
|
:key="item.id"
|
||||||
|
:data="item"
|
||||||
|
:name="name"
|
||||||
|
:num="index + 1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import RecipesCom from "./RecipesCom";
|
||||||
|
import RecipesAspectCom from "./RecipesAspectCom";
|
||||||
|
export default {
|
||||||
|
name: "RecipesView",
|
||||||
|
components: {
|
||||||
|
RecipesCom,
|
||||||
|
RecipesAspectCom,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
mCollapse() {
|
||||||
|
return analyseData.length ? this.collapse : false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
collapse: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: ["data", "analyseData", "name", "numRange"],
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped >
|
||||||
|
.recipes_view_wrapper {
|
||||||
|
// padding-right: 20px;
|
||||||
|
|
||||||
|
.recipes_content {
|
||||||
|
overflow: auto;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
22
stdiet-ui/src/views/custom/recipesBuild/RecommondView.vue
Normal file
22
stdiet-ui/src/views/custom/recipesBuild/RecommondView.vue
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
<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>
|
@ -1,26 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="recipes_build_wrapper">
|
||||||
<div class="content">
|
<div class="left" v-loading="recipesDataLoading">
|
||||||
<div class="left">
|
<RecipesView
|
||||||
<RecipesView :data="recipesData" />
|
v-if="!!recipesData.length"
|
||||||
|
:data="recipesData"
|
||||||
|
:name="healthyData.name"
|
||||||
|
:analyseData="analyseData"
|
||||||
|
/>
|
||||||
|
<RecommondView v-else />
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right" v-loading="healthDataLoading">
|
||||||
<HealthyView :data="healthyData" v-if="healthyDataType === 0" />
|
<HealthyView :data="healthyData" v-if="healthyDataType === 0" />
|
||||||
<BodySignView :data="healthyData" v-else />
|
<BodySignView :data="healthyData" v-else />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { createNamespacedHelpers } from "vuex";
|
import { createNamespacedHelpers } from "vuex";
|
||||||
|
const {
|
||||||
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
|
mapActions,
|
||||||
"recipes"
|
mapState,
|
||||||
);
|
mapMutations,
|
||||||
|
mapGetters,
|
||||||
|
} = createNamespacedHelpers("recipes");
|
||||||
|
|
||||||
import HealthyView from "./HealthyView";
|
import HealthyView from "./HealthyView";
|
||||||
import BodySignView from "./BodySignView";
|
import BodySignView from "./BodySignView";
|
||||||
import RecipesView from "./RecipesView";
|
import RecipesView from "./RecipesView/index";
|
||||||
|
import RecommondView from "./RecommondView";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "BuildRecipies",
|
name: "BuildRecipies",
|
||||||
@ -28,12 +35,15 @@ export default {
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//
|
const { cusId, planId, startDate, endDate, recipesId } = this.$route.query;
|
||||||
// console.log({
|
|
||||||
// cusId: this.cusId,
|
this.init({
|
||||||
// recipesId: this.recipesId,
|
cusId,
|
||||||
// });
|
planId,
|
||||||
this.init({ cusId: this.cusId, recipesId: this.recipesId }).catch((err) => {
|
startDate,
|
||||||
|
endDate,
|
||||||
|
recipesId,
|
||||||
|
}).catch((err) => {
|
||||||
this.$message.error(err.message);
|
this.$message.error(err.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -45,14 +55,18 @@ export default {
|
|||||||
HealthyView,
|
HealthyView,
|
||||||
BodySignView,
|
BodySignView,
|
||||||
RecipesView,
|
RecipesView,
|
||||||
|
RecommondView,
|
||||||
},
|
},
|
||||||
props: ["planId", "cusId", "recipesId"],
|
// props: ["cusId", "planId", "recipesId", "startDate", "endDate"],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState([
|
||||||
healthyData: (state) => state.healthyData,
|
"healthyData",
|
||||||
healthyDataType: (state) => state.healthyDataType,
|
"healthyDataType",
|
||||||
recipesData: (state) => state.recipesData,
|
"recipesData",
|
||||||
}),
|
"recipesDataLoading",
|
||||||
|
"healthDataLoading",
|
||||||
|
]),
|
||||||
|
...mapGetters(["analyseData"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(["init"]),
|
...mapActions(["init"]),
|
||||||
@ -60,15 +74,17 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss">
|
<style lang="scss" scoped>
|
||||||
.content {
|
.recipes_build_wrapper {
|
||||||
|
padding: 16px;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: calc(100vh - 124px);
|
height: calc(100vh - 86px);
|
||||||
.left {
|
.left {
|
||||||
flex: 4;
|
flex: 4;
|
||||||
border-right: 1px solid #e6ebf5;
|
border-right: 1px solid #e6ebf5;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: auto;
|
overflow: hidden;
|
||||||
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
.right {
|
.right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
@ -111,14 +111,14 @@
|
|||||||
:data="recipesPlanList"
|
:data="recipesPlanList"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
<el-table-column label="客户姓名" align="center" prop="customer" />
|
||||||
<el-table-column
|
<!-- <el-table-column
|
||||||
label="客户手机号"
|
label="客户手机号"
|
||||||
align="center"
|
align="center"
|
||||||
prop="hidePhone"
|
prop="hidePhone"
|
||||||
width="180"
|
width="180"
|
||||||
/>
|
/> -->
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="食谱日期范围"
|
label="食谱日期范围"
|
||||||
align="center"
|
align="center"
|
||||||
@ -170,14 +170,14 @@
|
|||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-view"
|
||||||
@click="
|
@click="
|
||||||
allRecipesPlanQueryParam.orderId = scope.row.orderId;
|
allRecipesPlanQueryParam.orderId = scope.row.orderId;
|
||||||
getAllPlanByOrderId();
|
getAllPlanByOrderId();
|
||||||
"
|
"
|
||||||
>查看完整计划
|
>查看完整计划
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<!-- <el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@ -192,13 +192,15 @@
|
|||||||
@click="getCustomerSign(scope.row)"
|
@click="getCustomerSign(scope.row)"
|
||||||
v-hasPermi="['custom:customer:query']"
|
v-hasPermi="['custom:customer:query']"
|
||||||
>查看体征
|
>查看体征
|
||||||
</el-button>
|
</el-button> -->
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
:icon="`${
|
||||||
|
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||||
|
}`"
|
||||||
@click="handleBuild(scope.row)"
|
@click="handleBuild(scope.row)"
|
||||||
>{{ `${scope.row.recipes_id ? "编辑" : "制作"}食谱` }}</el-button
|
>{{ `${scope.row.recipesId ? "编辑" : "制作"}食谱` }}</el-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -234,8 +236,7 @@
|
|||||||
|
|
||||||
<!-- 查看完整计划 -->
|
<!-- 查看完整计划 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="食谱计划表"
|
:title="allRecipesPlanTitle"
|
||||||
v-if="allRecipesPlanOpen"
|
|
||||||
:visible.sync="allRecipesPlanOpen"
|
:visible.sync="allRecipesPlanOpen"
|
||||||
width="800px"
|
width="800px"
|
||||||
append-to-body
|
append-to-body
|
||||||
@ -267,7 +268,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="allRecipesPlanList" width="700px">
|
<el-table v-loading="loading" :data="allRecipesPlanList" width="700px">
|
||||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
<!-- <el-table-column label="客户姓名" align="center" prop="customer" /> -->
|
||||||
<!--<el-table-column label="营养师名称" align="center" prop="nutritionist" />
|
<!--<el-table-column label="营养师名称" align="center" prop="nutritionist" />
|
||||||
<el-table-column label="营养师助理名称" align="center" prop="nutritionistAssis" />-->
|
<el-table-column label="营养师助理名称" align="center" prop="nutritionistAssis" />-->
|
||||||
|
|
||||||
@ -311,9 +312,9 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 查看订单 -->
|
<!-- 查看订单 -->
|
||||||
<order-dialog ref="orderDialog" />
|
<!-- <order-dialog ref="orderDialog" /> -->
|
||||||
<!-- 查看体征 -->
|
<!-- 查看体征 -->
|
||||||
<body_sign_dialog ref="bodySignDialog" />
|
<!-- <body_sign_dialog ref="bodySignDialog" /> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -325,10 +326,11 @@ import {
|
|||||||
updateRecipesPlan,
|
updateRecipesPlan,
|
||||||
} from "@/api/custom/recipesPlan";
|
} from "@/api/custom/recipesPlan";
|
||||||
import { getOptions } from "@/api/custom/order";
|
import { getOptions } from "@/api/custom/order";
|
||||||
import OrderDetail from "@/components/OrderDetail";
|
// import OrderDetail from "@/components/OrderDetail";
|
||||||
import BodySignDetail from "@/components/BodySignDetail";
|
// import BodySignDetail from "@/components/BodySignDetail";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import { mapState } from "vuex";
|
||||||
|
|
||||||
const nextDate = dayjs().add(1, "day").format("YYYY-MM-DD");
|
const nextDate = dayjs().add(1, "day").format("YYYY-MM-DD");
|
||||||
const weekDate = dayjs().add(6, "day").format("YYYY-MM-DD");
|
const weekDate = dayjs().add(6, "day").format("YYYY-MM-DD");
|
||||||
@ -376,6 +378,7 @@ export default {
|
|||||||
allRecipesPlanList: [],
|
allRecipesPlanList: [],
|
||||||
//订单弹窗状态
|
//订单弹窗状态
|
||||||
allRecipesPlanOpen: false,
|
allRecipesPlanOpen: false,
|
||||||
|
allRecipesPlanTitle: "",
|
||||||
//订单弹窗中查询参数
|
//订单弹窗中查询参数
|
||||||
allRecipesPlanQueryParam: {
|
allRecipesPlanQueryParam: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@ -385,47 +388,41 @@ export default {
|
|||||||
},
|
},
|
||||||
//订单弹窗中列表数据的总条数
|
//订单弹窗中列表数据的总条数
|
||||||
allRecipesPlanTotal: 0,
|
allRecipesPlanTotal: 0,
|
||||||
//营养师
|
|
||||||
nutritionistIdOptions: [],
|
|
||||||
//营养师助理
|
|
||||||
nutriAssisIdOptions: [],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
"order-dialog": OrderDetail,
|
// "order-dialog": OrderDetail,
|
||||||
body_sign_dialog: BodySignDetail,
|
// body_sign_dialog: BodySignDetail,
|
||||||
},
|
},
|
||||||
created() {
|
computed: {
|
||||||
getOptions().then((response) => {
|
...mapState({
|
||||||
const options = response.data.reduce((opts, cur) => {
|
//营养师
|
||||||
if (!opts[cur.postCode]) {
|
nutritionistIdOptions: (state) =>
|
||||||
opts[cur.postCode] = [
|
state.global.nutritionistIdOptions.slice(1),
|
||||||
{ dictValue: null, dictLabel: "全部", remark: null },
|
//营养师助理
|
||||||
];
|
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
||||||
}
|
}),
|
||||||
opts[cur.postCode].push({
|
},
|
||||||
dictValue: cur.userId,
|
watch: {
|
||||||
dictLabel: cur.userName,
|
nutritionistIdOptions: function (val, oldVal) {
|
||||||
remark: cur.remark,
|
if (val.length && !oldVal.length) {
|
||||||
});
|
const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||||
return opts;
|
if (tarObj) {
|
||||||
}, {});
|
|
||||||
this.nutritionistIdOptions = options["nutri"] || [];
|
|
||||||
this.nutriAssisIdOptions = options["nutri_assis"] || [];
|
|
||||||
const defaultNutritionist = this.nutritionistIdOptions.find(
|
|
||||||
(opt) => opt.dictValue == userId
|
|
||||||
);
|
|
||||||
const defaultNutriAssisId = this.nutriAssisIdOptions.find(
|
|
||||||
(opt) => opt.dictValue == userId
|
|
||||||
);
|
|
||||||
if (defaultNutritionist) {
|
|
||||||
this.queryParams.nutritionistId = userId;
|
this.queryParams.nutritionistId = userId;
|
||||||
}
|
}
|
||||||
if (defaultNutriAssisId) {
|
}
|
||||||
|
},
|
||||||
|
nutriAssisIdOptions: function (val, oldVal) {
|
||||||
|
if (val.length && !oldVal.length) {
|
||||||
|
const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||||
|
if (tarObj) {
|
||||||
this.queryParams.nutritionistAssisId = userId;
|
this.queryParams.nutritionistAssisId = userId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询食谱计划列表 */
|
/** 查询食谱计划列表 */
|
||||||
@ -474,6 +471,7 @@ export default {
|
|||||||
dayjs(item.endDate).format("YYYY-MM-DD");
|
dayjs(item.endDate).format("YYYY-MM-DD");
|
||||||
});
|
});
|
||||||
this.allRecipesPlanOpen = true;
|
this.allRecipesPlanOpen = true;
|
||||||
|
this.allRecipesPlanTitle = `「${this.allRecipesPlanList[0].customer}」食谱计划表`;
|
||||||
this.allRecipesPlanTotal = response.total;
|
this.allRecipesPlanTotal = response.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -604,20 +602,26 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleBuild(data) {
|
handleBuild(data) {
|
||||||
|
// console.log(data);
|
||||||
|
const { startDate, endDate, id, cusId, recipesId } = data;
|
||||||
|
|
||||||
// const params = { id: data.id, cusId: data.orderId };
|
// const params = { id: data.id, cusId: data.orderId };
|
||||||
let path = `/recipes/build/${data.orderId}/${data.id}`;
|
// const path = `/recipes/build/${orderId}/${id}/${recipesId || 0}`;
|
||||||
if (data.recipes_id) {
|
|
||||||
// params.recipesId = data.recipes_id;
|
|
||||||
path += `/${data.recipes_id}`;
|
|
||||||
}
|
|
||||||
// test
|
|
||||||
// params.recipesId = "61";
|
|
||||||
path += '/73';
|
|
||||||
// this.$router.push({
|
// this.$router.push({
|
||||||
// name: "build",
|
// name: "build",
|
||||||
// params,
|
// params,
|
||||||
// });
|
// });
|
||||||
this.$router.push(path);
|
const queryParam = {
|
||||||
|
planId: id,
|
||||||
|
cusId,
|
||||||
|
};
|
||||||
|
if (!recipesId) {
|
||||||
|
queryParam.startDate = startDate;
|
||||||
|
queryParam.endDate = endDate;
|
||||||
|
} else {
|
||||||
|
queryParam.recipesId = recipesId;
|
||||||
|
}
|
||||||
|
this.$router.push({ path: "/recipes/build", query: queryParam });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="销售" prop="userId">
|
<el-form-item label="销售" prop="userId">
|
||||||
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.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"
|
||||||
@ -12,7 +24,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="销售组别" prop="saleGroupId">
|
<el-form-item label="销售组别" prop="saleGroupId">
|
||||||
<el-select v-model="queryParams.saleGroupId" placeholder="请选择组别" filterable clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.saleGroupId"
|
||||||
|
placeholder="请选择组别"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in saleGroupOptions"
|
v-for="dict in saleGroupOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -22,7 +40,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="进粉渠道" prop="accountId">
|
<el-form-item label="进粉渠道" prop="accountId">
|
||||||
<el-select v-model="queryParams.accountId" filterable placeholder="请选择渠道" clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.accountId"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择渠道"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in accountIdOptions"
|
v-for="dict in accountIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -41,8 +65,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>-->
|
</el-form-item>-->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -54,7 +86,8 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['custom:wxDistribution:add']"
|
v-hasPermi="['custom:wxDistribution:add']"
|
||||||
>新增</el-button>
|
>新增</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -64,7 +97,8 @@
|
|||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['custom:wxDistribution:edit']"
|
v-hasPermi="['custom:wxDistribution:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -74,7 +108,8 @@
|
|||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['custom:wxDistribution:remove']"
|
v-hasPermi="['custom:wxDistribution:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -83,24 +118,42 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['custom:wxDistribution:export']"
|
v-hasPermi="['custom:wxDistribution:export']"
|
||||||
>导出</el-button>
|
>导出</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="wxDistributionList" stripe @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="wxDistributionList"
|
||||||
|
stripe
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="销售姓名" align="center" prop="userName" />
|
<el-table-column label="销售姓名" align="center" prop="userName" />
|
||||||
<el-table-column label="微信昵称" align="center" prop="wxNickName" />
|
<el-table-column label="微信昵称" align="center" prop="wxNickName" />
|
||||||
<el-table-column label="微信号" align="center" prop="wxAccount" />
|
<el-table-column label="微信号" align="center" prop="wxAccount" />
|
||||||
<el-table-column label="进粉渠道" align="center" prop="account" />
|
<el-table-column label="进粉渠道" align="center" prop="account" />
|
||||||
<el-table-column label="销售组别" align="center" prop="saleGroup" />
|
<el-table-column label="销售组别" align="center" prop="saleGroup" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -108,14 +161,16 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['custom:wxDistribution:edit']"
|
v-hasPermi="['custom:wxDistribution:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['custom:wxDistribution:remove']"
|
v-hasPermi="['custom:wxDistribution:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -132,7 +187,13 @@
|
|||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="销售" prop="userId">
|
<el-form-item label="销售" prop="userId">
|
||||||
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small">
|
<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"
|
||||||
@ -142,7 +203,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="销售组别" prop="saleGroupId">
|
<el-form-item label="销售组别" prop="saleGroupId">
|
||||||
<el-select v-model="form.saleGroupId" placeholder="请选择组别" filterable clearable size="small">
|
<el-select
|
||||||
|
v-model="form.saleGroupId"
|
||||||
|
placeholder="请选择组别"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in saleGroupOptions"
|
v-for="dict in saleGroupOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -152,7 +219,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="进粉渠道" prop="accountId">
|
<el-form-item label="进粉渠道" prop="accountId">
|
||||||
<el-select v-model="form.accountId" filterable placeholder="请选择渠道" clearable size="small">
|
<el-select
|
||||||
|
v-model="form.accountId"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择渠道"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in accountIdOptions"
|
v-for="dict in accountIdOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -162,7 +235,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="微信号" prop="wechatAccount">
|
<el-form-item label="微信号" prop="wechatAccount">
|
||||||
<el-select v-model="form.wechatAccount" filterable placeholder="请选择微信号" clearable size="small">
|
<el-select
|
||||||
|
v-model="form.wechatAccount"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择微信号"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in wxAccountList"
|
v-for="dict in wxAccountList"
|
||||||
:key="dict.id"
|
:key="dict.id"
|
||||||
@ -181,9 +260,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listWxDistribution, getWxDistribution, delWxDistribution, addWxDistribution, updateWxDistribution, exportWxDistribution } from "@/api/custom/wxDistribution";
|
import {
|
||||||
|
listWxDistribution,
|
||||||
|
getWxDistribution,
|
||||||
|
delWxDistribution,
|
||||||
|
addWxDistribution,
|
||||||
|
updateWxDistribution,
|
||||||
|
exportWxDistribution,
|
||||||
|
} from "@/api/custom/wxDistribution";
|
||||||
import { getOptions } from "@/api/custom/order";
|
import { getOptions } from "@/api/custom/order";
|
||||||
import { listWxAccount } from "@/api/custom/wxAccount";
|
import { listWxAccount } from "@/api/custom/wxAccount";
|
||||||
|
import { mapState } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "WxDistribution",
|
name: "WxDistribution",
|
||||||
data() {
|
data() {
|
||||||
@ -220,36 +307,26 @@
|
|||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
userId: [{ required: true, trigger: "blur", message: "请选择销售" }],
|
userId: [{ required: true, trigger: "blur", message: "请选择销售" }],
|
||||||
saleGroupId: [{ required: true, trigger: "blur", message: "请选择组别" }],
|
saleGroupId: [
|
||||||
accountId: [{ required: true, trigger: "blur", message: "请选择进粉账号" }],
|
{ required: true, trigger: "blur", message: "请选择组别" },
|
||||||
wechatAccount: [{ required: true, trigger: "blur", message: "请选择微信号" }]
|
],
|
||||||
|
accountId: [
|
||||||
|
{ required: true, trigger: "blur", message: "请选择进粉账号" },
|
||||||
|
],
|
||||||
|
wechatAccount: [
|
||||||
|
{ required: true, trigger: "blur", message: "请选择微信号" },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
//售前
|
|
||||||
preSaleIdOptions:[],
|
|
||||||
//进粉账号列表
|
//进粉账号列表
|
||||||
accountIdOptions: [],
|
accountIdOptions: [],
|
||||||
//销售组别列表
|
//销售组别列表
|
||||||
saleGroupOptions: [],
|
saleGroupOptions: [],
|
||||||
//微信号列表
|
//微信号列表
|
||||||
wxAccountList:[]
|
wxAccountList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
getOptions().then((response) => {
|
|
||||||
const options = response.data.reduce((opts, cur) => {
|
|
||||||
if (!opts[cur.postCode]) {
|
|
||||||
opts[cur.postCode] = [];
|
|
||||||
}
|
|
||||||
opts[cur.postCode].push({
|
|
||||||
dictValue: cur.userId,
|
|
||||||
dictLabel: cur.userName,
|
|
||||||
remark: cur.remark,
|
|
||||||
});
|
|
||||||
return opts;
|
|
||||||
}, {});
|
|
||||||
this.preSaleIdOptions = options["pre_sale"] || [];
|
|
||||||
});
|
|
||||||
this.getDicts("fan_channel").then((response) => {
|
this.getDicts("fan_channel").then((response) => {
|
||||||
this.accountIdOptions = response.data;
|
this.accountIdOptions = response.data;
|
||||||
});
|
});
|
||||||
@ -258,11 +335,17 @@
|
|||||||
});
|
});
|
||||||
this.getListWxAccount();
|
this.getListWxAccount();
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
//售前
|
||||||
|
preSaleIdOptions: (state) => state.global.preSaleIdOptions.slice(1),
|
||||||
|
}),
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询微信分配管理列表 */
|
/** 查询微信分配管理列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listWxDistribution(this.queryParams).then(response => {
|
listWxDistribution(this.queryParams).then((response) => {
|
||||||
this.wxDistributionList = response.rows;
|
this.wxDistributionList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@ -279,7 +362,7 @@
|
|||||||
userId: null,
|
userId: null,
|
||||||
saleGroupId: null,
|
saleGroupId: null,
|
||||||
accountId: null,
|
accountId: null,
|
||||||
wechatAccount: null
|
wechatAccount: null,
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -295,9 +378,9 @@
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map((item) => item.id);
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -308,8 +391,8 @@
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids;
|
||||||
getWxDistribution(id).then(response => {
|
getWxDistribution(id).then((response) => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改微信分配";
|
this.title = "修改微信分配";
|
||||||
@ -317,10 +400,10 @@
|
|||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateWxDistribution(this.form).then(response => {
|
updateWxDistribution(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -328,7 +411,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addWxDistribution(this.form).then(response => {
|
addWxDistribution(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -342,35 +425,45 @@
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
this.$confirm('是否确认删除微信号为"' + row.wxNickName + '"的数据项?', "警告", {
|
this.$confirm(
|
||||||
|
'是否确认删除微信号为"' + row.wxNickName + '"的数据项?',
|
||||||
|
"警告",
|
||||||
|
{
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function() {
|
}
|
||||||
|
)
|
||||||
|
.then(function () {
|
||||||
return delWxDistribution(ids);
|
return delWxDistribution(ids);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
}).catch(function() {});
|
})
|
||||||
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
this.$confirm('是否确认导出所有微信分配数据项?', "警告", {
|
this.$confirm("是否确认导出所有微信分配数据项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function() {
|
})
|
||||||
|
.then(function () {
|
||||||
return exportWxDistribution(queryParams);
|
return exportWxDistribution(queryParams);
|
||||||
}).then(response => {
|
})
|
||||||
|
.then((response) => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
}).catch(function() {});
|
})
|
||||||
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
getListWxAccount() {
|
getListWxAccount() {
|
||||||
listWxAccount(this.queryParams).then(response => {
|
listWxAccount(this.queryParams).then((response) => {
|
||||||
this.wxAccountList = response.rows;
|
this.wxAccountList = response.rows;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user