添加食谱模板
This commit is contained in:
parent
1d7b7cd259
commit
77d5d346b1
@ -0,0 +1,68 @@
|
|||||||
|
package com.stdiet.web.controller.custom;
|
||||||
|
|
||||||
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
|
import com.stdiet.common.core.page.TableDataInfo;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||||
|
import com.stdiet.custom.service.ISysRecipesPlanModelService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食谱模板
|
||||||
|
*
|
||||||
|
* @author wonder
|
||||||
|
* @date 2021-02-27
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/recipes/model")
|
||||||
|
public class SysRecipesPlanModelController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysRecipesPlanModelService iSysRecipesPlanModelService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesModel:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||||
|
startPage();
|
||||||
|
List<SysRecipesPlanModel> list = iSysRecipesPlanModelService.selectRecipesModelListByCondition(sysRecipesPlanModel);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesModel:edit')")
|
||||||
|
@PostMapping("/add")
|
||||||
|
public AjaxResult add(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||||
|
return toAjax(iSysRecipesPlanModelService.insertRecipsesModel(sysRecipesPlanModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*
|
||||||
|
* @param sysRecipesPlanModel
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:list')")
|
||||||
|
@PutMapping(value = "/update")
|
||||||
|
public AjaxResult update(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||||
|
return toAjax(iSysRecipesPlanModelService.updateRecipesModel(sysRecipesPlanModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:query')")
|
||||||
|
@DeleteMapping(value = "/delete/{id}")
|
||||||
|
public AjaxResult delete(@PathVariable("id") Long id) {
|
||||||
|
return AjaxResult.success(iSysRecipesPlanModelService.removeRecipesModel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -137,4 +137,7 @@ public class SysRecipesPlan {
|
|||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
// 0-普通 1-模板
|
||||||
|
private Integer type;
|
||||||
}
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysRecipesPlanModel {
|
||||||
|
Long id;
|
||||||
|
|
||||||
|
Long nutritionistId;
|
||||||
|
|
||||||
|
Long nutriAssisId;
|
||||||
|
|
||||||
|
Long planId;
|
||||||
|
|
||||||
|
String remark;
|
||||||
|
|
||||||
|
Date updateTime;
|
||||||
|
|
||||||
|
Date createTime;
|
||||||
|
|
||||||
|
String updateBy;
|
||||||
|
|
||||||
|
String createBy;
|
||||||
|
|
||||||
|
Long recipesId;
|
||||||
|
}
|
@ -93,4 +93,6 @@ public interface SysRecipesPlanMapper
|
|||||||
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
|
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
|
||||||
|
|
||||||
List<SysRecipesPlan> selectPlanListByCusId(Long cusId);
|
List<SysRecipesPlan> selectPlanListByCusId(Long cusId);
|
||||||
|
|
||||||
|
List<SysRecipesPlan> selectRecipesModelList(SysRecipesPlan sysRecipesPlan);
|
||||||
}
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.stdiet.custom.mapper;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食谱计划Mapper接口
|
||||||
|
*
|
||||||
|
* @author wonder
|
||||||
|
* @date 2021-02-27
|
||||||
|
*/
|
||||||
|
public interface SysRecipesPlanModelMapper
|
||||||
|
{
|
||||||
|
List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel);
|
||||||
|
|
||||||
|
int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||||
|
|
||||||
|
int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||||
|
|
||||||
|
int removeRecipesModel(Long id);
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.stdiet.custom.service;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食谱计划Service接口
|
||||||
|
*
|
||||||
|
* @author wonder
|
||||||
|
* @date 2021-02-27
|
||||||
|
*/
|
||||||
|
public interface ISysRecipesPlanModelService
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel);
|
||||||
|
|
||||||
|
int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||||
|
|
||||||
|
int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||||
|
|
||||||
|
int removeRecipesModel(Long id);
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
|
import com.stdiet.common.utils.DateUtils;
|
||||||
|
import com.stdiet.common.utils.SecurityUtils;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||||
|
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||||
|
import com.stdiet.custom.mapper.SysRecipesPlanModelMapper;
|
||||||
|
import com.stdiet.custom.service.ISysRecipesPlanModelService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食谱计划Service业务层处理
|
||||||
|
*
|
||||||
|
* @author wonder
|
||||||
|
* @date 2021-02-27
|
||||||
|
*/
|
||||||
|
@Service("sysRecipesPlanModelService")
|
||||||
|
@Transactional
|
||||||
|
public class SysRecipesPlanModelServiceImpl implements ISysRecipesPlanModelService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysRecipesPlanModelMapper sysRecipesPlanModelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysRecipesPlanMapper sysRecipesPlanMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||||
|
return sysRecipesPlanModelMapper.selectRecipesModelListByCondition(sysRecipesPlanModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||||
|
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||||
|
sysRecipesPlan.setStartNumDay(1);
|
||||||
|
sysRecipesPlan.setEndNumDay(7);
|
||||||
|
sysRecipesPlan.setType(1);
|
||||||
|
int rows = sysRecipesPlanMapper.insertSysRecipesPlan(sysRecipesPlan);
|
||||||
|
if (rows > 0) {
|
||||||
|
sysRecipesPlanModel.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
sysRecipesPlanModel.setCreateTime(DateUtils.getNowDate());
|
||||||
|
sysRecipesPlanModel.setPlanId(sysRecipesPlan.getId());
|
||||||
|
return sysRecipesPlanModelMapper.insertRecipsesModel(sysRecipesPlanModel);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||||
|
sysRecipesPlanModel.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
sysRecipesPlanModel.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return sysRecipesPlanModelMapper.updateRecipesModel(sysRecipesPlanModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int removeRecipesModel(Long id) {
|
||||||
|
return sysRecipesPlanModelMapper.removeRecipesModel(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -308,4 +308,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
return sysRecipesPlanMapper.selectPlanListByCusId(cusId);
|
return sysRecipesPlanMapper.selectPlanListByCusId(cusId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SysRecipesPlan> selectRecipesModelList(SysRecipesPlan sysRecipesPlan) {
|
||||||
|
return sysRecipesPlanMapper.selectRecipesModelList(sysRecipesPlan);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -157,11 +157,9 @@
|
|||||||
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_customer sc ON sc.id = srp.cus_id
|
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
|
||||||
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag
|
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
|
||||||
= 0
|
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND su_nutritionist_assis.del_flag = 0
|
||||||
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND
|
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.type = 0
|
||||||
su_nutritionist_assis.del_flag = 0
|
|
||||||
WHERE srp.del_flag = 0 and sr.del_flag = 0
|
|
||||||
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
||||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||||
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like
|
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like
|
||||||
@ -205,7 +203,8 @@
|
|||||||
|
|
||||||
<!-- 根据cusId查询食谱计划-->
|
<!-- 根据cusId查询食谱计划-->
|
||||||
<select id="selectPlanListByCusId" parameterType="Long" resultMap="SysRecipesPlanResult">
|
<select id="selectPlanListByCusId" parameterType="Long" resultMap="SysRecipesPlanResult">
|
||||||
select id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, review_status from sys_recipes_plan where cus_id=#{cusId} order by create_time desc
|
select id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, review_status from sys_recipes_plan
|
||||||
|
where cus_id=#{cusId} order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
|
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
|
||||||
@ -234,4 +233,5 @@
|
|||||||
<select id="selectMenuIds" parameterType="Long" resultMap="SysRecipesResult">
|
<select id="selectMenuIds" parameterType="Long" resultMap="SysRecipesResult">
|
||||||
select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} order by num_day asc
|
select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} order by num_day asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.stdiet.custom.mapper.SysRecipesPlanModelMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysRecipesPlanModel" id="SysRecipesModelResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="planId" column="plan_id"/>
|
||||||
|
<result property="nutritionistId" column="nutritionist_id"/>
|
||||||
|
<result property="nutriAssisId" column="nutri_assis_id"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="recipesId" column="recipes_id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectRecipesModelListByCondition" parameterType="SysRecipesPlanModel" resultMap="SysRecipesModelResult">
|
||||||
|
select srpm.id, srpm.nutritionist_id, srpm.nutri_assis_id, srpm.remark, srpm.update_time,
|
||||||
|
srpm.create_time, srpm.update_by, srpm.create_by, srpm.plan_id, srp.recipes_id, srp.review_status
|
||||||
|
from sys_recipes_plan_model srpm
|
||||||
|
left join sys_recipes_plan srp on srp.id = srpm.plan_id
|
||||||
|
where del_flag = 0
|
||||||
|
<if test="nutriAssisId != null ">and nutri_assis_id = #{nutriAssisId}</if>
|
||||||
|
<if test="nutritionistId != null ">and nutritionist_id = #{nutritionistId}</if>
|
||||||
|
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
|
||||||
|
order by srpm.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertRecipsesModel" parameterType="SysRecipesPlanModel" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_recipes_plan_model
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="nutriAssisId != null">nutri_assis_id,</if>
|
||||||
|
<if test="nutritionistId != null">nutritionist_id,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="reviewStatus != null">review_status,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="nutriAssisId != null">#{nutriAssisId},</if>
|
||||||
|
<if test="nutritionistId != null">#{nutritionistId},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateRecipesModel" parameterType="SysRecipesPlanModel">
|
||||||
|
update sys_recipes_plan_model
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="nutriAssisId != null">nutri_assis_id = #{nutriAssisId},</if>
|
||||||
|
<if test="nutritionistId != null">nutritionist_id = #{nutritionistId},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="removeRecipesModel" parameterType="Long">
|
||||||
|
update sys_recipes_plan_model set del_flag=1 where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
33
stdiet-ui/src/api/custom/recipesPlanModel.js
Normal file
33
stdiet-ui/src/api/custom/recipesPlanModel.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
export function listRecipesModel(query) {
|
||||||
|
return request({
|
||||||
|
url: "/recipes/model/list",
|
||||||
|
method: "get",
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addRecipesModel(data){
|
||||||
|
return request({
|
||||||
|
url: "/recipes/model/add",
|
||||||
|
method: "post",
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateRecipesModel(data) {
|
||||||
|
return request({
|
||||||
|
url: "/recipes/model/update",
|
||||||
|
method: "put",
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function deleteRecipesModel(id) {
|
||||||
|
return request({
|
||||||
|
url: "/recipes/model/delete/" + id,
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
@ -12,7 +12,7 @@
|
|||||||
<el-table-column prop="type" :width="100" align="center">
|
<el-table-column prop="type" :width="100" align="center">
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||||
<div>{{ name }}</div>
|
<!-- <div>{{ name }}</div> -->
|
||||||
<div>{{ `第${numDay}天` }}</div>
|
<div>{{ `第${numDay}天` }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
331
stdiet-ui/src/views/custom/recipesModel/index.vue
Normal file
331
stdiet-ui/src/views/custom/recipesModel/index.vue
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
>
|
||||||
|
<el-form-item label="营养师" prop="nutritionistId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.nutritionistId"
|
||||||
|
placeholder="请选择营养师"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutritionistIdOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="营养师助理" prop="nutritionistAssisId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.nutritionistAssisId"
|
||||||
|
placeholder="请选择营养师助理"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutriAssisIdOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="审核状态" prop="reviewStatus">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.reviewStatus"
|
||||||
|
placeholder="请选审核状态"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in reviewStatusOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="cyan"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
||||||
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="recipesPlanList">
|
||||||
|
<el-table-column label="审核状态" align="center" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag
|
||||||
|
:type="
|
||||||
|
!scope.row.reviewStatus
|
||||||
|
? 'info'
|
||||||
|
: scope.row.reviewStatus === 1
|
||||||
|
? 'danger'
|
||||||
|
: 'success'
|
||||||
|
"
|
||||||
|
>{{
|
||||||
|
`${
|
||||||
|
!scope.row.reviewStatus
|
||||||
|
? "未制作"
|
||||||
|
: scope.row.reviewStatus == 1
|
||||||
|
? "未审核"
|
||||||
|
: "已审核"
|
||||||
|
}`
|
||||||
|
}}</el-tag
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="营养师"
|
||||||
|
align="center"
|
||||||
|
prop="nutritionist"
|
||||||
|
width="100"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="营养师助理"
|
||||||
|
align="center"
|
||||||
|
width="100"
|
||||||
|
prop="nutritionistAssis"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
width="100"
|
||||||
|
prop="create_time"
|
||||||
|
/>
|
||||||
|
<el-table-column label="备注" prop="remark" align="center" />
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
width="300"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
v-hasPermi="['recipes:recipesPlan:edit']"
|
||||||
|
:icon="`${
|
||||||
|
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||||
|
}`"
|
||||||
|
@click="handleBuild(scope.row)"
|
||||||
|
>{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listRecipesModel,
|
||||||
|
addRecipesModel,
|
||||||
|
updateRecipesModel,
|
||||||
|
deleteRecipesModel,
|
||||||
|
} from "@/api/custom/recipesPlanModel";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import store from "@/store";
|
||||||
|
import { mapState } from "vuex";
|
||||||
|
|
||||||
|
const userId = store.getters && store.getters.userId;
|
||||||
|
export default {
|
||||||
|
name: "recipesPlan",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 食谱计划表格数据
|
||||||
|
recipesPlanList: [],
|
||||||
|
orderDialog: undefined,
|
||||||
|
reviewStatusOptions: [
|
||||||
|
{ dictValue: 0, dictLabel: "未制作" },
|
||||||
|
{ dictValue: 1, dictLabel: "未审核" },
|
||||||
|
{ dictValue: 2, dictLabel: "已审核" },
|
||||||
|
],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
nutritionistId: null,
|
||||||
|
nutritionistAssisId: null,
|
||||||
|
reviewStatus: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {},
|
||||||
|
//食谱开始时间范围
|
||||||
|
planStartDateScope: [nextDate, nextDate],
|
||||||
|
//订单对于所有计划安排数据
|
||||||
|
allRecipesPlanList: [],
|
||||||
|
//订单弹窗状态
|
||||||
|
allRecipesPlanOpen: false,
|
||||||
|
allRecipesPlanTitle: "",
|
||||||
|
//订单弹窗中查询参数
|
||||||
|
allRecipesPlanQueryParam: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
orderId: null,
|
||||||
|
sendFlag: 0,
|
||||||
|
},
|
||||||
|
//订单弹窗中列表数据的总条数
|
||||||
|
allRecipesPlanTotal: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
// "order-dialog": OrderDetail,
|
||||||
|
// body_sign_dialog: BodySignDetail,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
//营养师
|
||||||
|
nutritionistIdOptions: (state) =>
|
||||||
|
state.global.nutritionistIdOptions.slice(1),
|
||||||
|
//营养师助理
|
||||||
|
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
nutritionistIdOptions: function (val, oldVal) {
|
||||||
|
if (val.length && !oldVal.length) {
|
||||||
|
const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||||
|
if (tarObj) {
|
||||||
|
this.queryParams.nutritionistId = userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nutriAssisIdOptions: function (val, oldVal) {
|
||||||
|
if (val.length && !oldVal.length) {
|
||||||
|
const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||||
|
if (tarObj) {
|
||||||
|
this.queryParams.nutritionistAssisId = userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询食谱计划列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
if (
|
||||||
|
this.planStartDateScope != null &&
|
||||||
|
this.planStartDateScope.length > 0
|
||||||
|
) {
|
||||||
|
this.queryParams.startDate = dayjs(this.planStartDateScope[0]).format(
|
||||||
|
"YYYY-MM-DD"
|
||||||
|
);
|
||||||
|
this.queryParams.endDate = dayjs(this.planStartDateScope[1]).format(
|
||||||
|
"YYYY-MM-DD"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.queryParams.startDate = null;
|
||||||
|
this.queryParams.endDate = null;
|
||||||
|
}
|
||||||
|
listRecipesPlan(this.queryParams).then((response) => {
|
||||||
|
this.recipesPlanList = response.rows;
|
||||||
|
this.recipesPlanList.forEach(function (item, index) {
|
||||||
|
item.scopeDate =
|
||||||
|
dayjs(item.startDate).format("YYYY-MM-DD") +
|
||||||
|
" 至 " +
|
||||||
|
dayjs(item.endDate).format("YYYY-MM-DD");
|
||||||
|
item.scopeDay = `第${item.startNumDay} 至 ${item.endNumDay}天`;
|
||||||
|
});
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
orderId: null,
|
||||||
|
startDate: null,
|
||||||
|
endDate: null,
|
||||||
|
recipesId: null,
|
||||||
|
sendFlag: null,
|
||||||
|
sendTime: null,
|
||||||
|
createTime: null,
|
||||||
|
createBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
delFlag: null,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.planStartDateScope = [nextDate, nextDate];
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
const queryParams = this.queryParams;
|
||||||
|
this.$confirm("是否确认导出所有食谱计划数据项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return exportRecipesPlan(queryParams);
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.download(response.msg);
|
||||||
|
})
|
||||||
|
.catch(function () {});
|
||||||
|
},
|
||||||
|
handleBuild(data) {
|
||||||
|
// console.log(data);
|
||||||
|
const { id, customer } = data;
|
||||||
|
window.open("/recipes/build/" + customer + "/" + id, "_blank");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user