新增忌口编写功能

This commit is contained in:
huangdeliang 2021-03-23 20:10:29 +08:00
parent 960a094649
commit 2ea3d01d6e
15 changed files with 874 additions and 478 deletions

View File

@ -1,5 +1,7 @@
package com.stdiet.custom.domain;
import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor;
import lombok.Data;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
@ -442,4 +444,6 @@ public class SysCustomerHealthy extends BaseEntity
/** 删除标识 0未删除 1已删除。默认0 */
private Long delFlag;
private JSONArray avoidFood;
}

View File

@ -1,10 +1,10 @@
package com.stdiet.custom.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.alibaba.fastjson.JSONArray;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
@ -13,478 +13,224 @@ import java.util.List;
* @author xzj
* @date 2020-12-31
*/
public class SysCustomerPhysicalSigns extends BaseEntity
{
private static final long serialVersionUID = 1L;
@Data
public class SysCustomerPhysicalSigns {
/** 体征ID */
/**
* 体征ID
*/
private Long id;
/** 客户id */
/**
* 客户id
*/
//@Excel(name = "客户id")
private Long customerId;
/** 客户姓名,非持久化字段 */
/**
* 客户姓名,非持久化字段
*/
@Excel(name = "客户姓名")
private String name;
/** 客户手机号,非持久化字段 */
/**
* 客户手机号,非持久化字段
*/
@Excel(name = "客户手机号")
private String phone;
/** 客户性别 0男 1女 */
/**
* 客户性别 0男 1女
*/
@Excel(name = "客户性别 0男 1女")
private Integer sex;
/** 客户年龄(岁) */
/**
* 客户年龄
*/
@Excel(name = "客户年龄", readConverterExp = "岁=")
private Integer age;
/** 客户身高(厘米) */
/**
* 客户身高厘米
*/
@Excel(name = "客户身高", readConverterExp = "厘=米")
private Integer tall;
/** 客户体重(斤) */
/**
* 客户体重
*/
@Excel(name = "客户体重", readConverterExp = "斤=")
private Integer weight;
/** 客户病史体征id */
/**
* 客户病史体征id
*/
@Excel(name = "客户病史体征id")
private String physicalSignsId;
/** 客户忌口不爱吃食材id */
/**
* 客户忌口不爱吃食材id
*/
@Excel(name = "客户忌口不爱吃食材id")
private String dishesIngredientId;
/** 客户照片 */
/**
* 客户照片
*/
@Excel(name = "客户照片")
private String photo;
/** 是否便秘 0是 1否 */
/**
* 是否便秘 0是 1否
*/
@Excel(name = "是否便秘 0是 1否")
private Integer constipation;
/** 是否熬夜、失眠 0是 1否 */
/**
* 是否熬夜失眠 0是 1否
*/
@Excel(name = "是否熬夜、失眠 0是 1否")
private Integer staylate;
/** 是否经常运动 0是 1否 */
/**
* 是否经常运动 0是 1否
*/
@Excel(name = "是否经常运动 0是 1否")
private Integer motion;
/** 饮食方式 0自己做 1外面吃 */
/**
* 饮食方式 0自己做 1外面吃
*/
@Excel(name = "饮食方式 0自己做 1外面吃")
private Integer makeFoodType;
/** 饮食特点 0清淡 1重口味 */
/**
* 饮食特点 0清淡 1重口味
*/
@Excel(name = "饮食特点 0清淡 1重口味")
private Integer makeFoodTaste;
/** 平时是否久坐 0久坐多 1走动多 */
/**
* 平时是否久坐 0久坐多 1走动多
*/
@Excel(name = "平时是否久坐 0久坐多 1走动多")
private Integer walk;
/** 减脂过程遇到的困难 */
/**
* 减脂过程遇到的困难
*/
@Excel(name = "减脂过程遇到的困难")
private String difficulty;
/** 是否浑身乏力 0是 1否 */
/**
* 是否浑身乏力 0是 1否
*/
@Excel(name = "是否浑身乏力 0是 1否")
private Integer weakness;
/** 是否减脂反弹 0是 1否 */
/**
* 是否减脂反弹 0是 1否
*/
@Excel(name = "是否减脂反弹 0是 1否")
private Integer rebound;
/** 能否认识到生活习惯的改善才是减脂的关键 0是 1否 */
/**
* 能否认识到生活习惯的改善才是减脂的关键 0是 1否
*/
@Excel(name = "能否认识到生活习惯的改善才是减脂的关键 0是 1否")
private Integer crux;
/** 南方人还是北方人 0南方 1北方 */
/**
* 南方人还是北方人 0南方 1北方
*/
@Excel(name = "南方人还是北方人 0南方 1北方")
private Integer position;
/** 睡觉时间24小时制 */
/**
* 睡觉时间24小时制
*/
@Excel(name = "睡觉时间", readConverterExp = "2=4小时制")
private Integer sleepTime;
/** 起床时间24小时制 */
/**
* 起床时间24小时制
*/
@Excel(name = "起床时间", readConverterExp = "2=4小时制")
private Integer getupTime;
/** 联系沟通时间24小时制 */
/**
* 联系沟通时间24小时制
*/
@Excel(name = "联系沟通时间", readConverterExp = "2=4小时制")
private Integer connectTime;
/** 饮食备注 */
/**
* 饮食备注
*/
@Excel(name = "饮食备注")
private String remarks;
/** 湿气数据 */
/**
* 营养师备注
*/
private String remark;
/**
* 湿气数据
*/
@Excel(name = "湿气数据")
private String bloodData;
/** 气血数据 */
/**
* 气血数据
*/
@Excel(name = "气血数据")
private String moistureDate;
/** 工作职业 */
/**
* 工作职业
*/
@Excel(name = "工作职业")
private String vocation;
/** 是否上夜班 */
/**
* 是否上夜班
*/
@Excel(name = "是否上夜班")
private Integer night;
/** 减脂经历 */
/**
* 减脂经历
*/
@Excel(name = "减脂经历")
private String experience;
/** 备注 */
/**
* 备注
*/
@Excel(name = "备注")
private String comments;
/** 删除标识(0 未删除 1已删除) */
/**
* 删除标识(0 未删除 1已删除)
*/
private Integer delFlag;
/** 体征对象集合 **/
/**
* 体征对象集合
**/
private List<SysPhysicalSigns> signList;
public void setId(Long id)
{
this.id = id;
}
private JSONArray avoidFood;
public Long getId()
{
return id;
}
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
private Date createTime;
public Long getCustomerId()
{
return customerId;
}
public void setSex(Integer sex)
{
this.sex = sex;
}
private Date updateTime;
public Integer getSex()
{
return sex;
}
public void setAge(Integer age)
{
this.age = age;
}
private String createBy;
public Integer getAge()
{
return age;
}
public void setTall(Integer tall)
{
this.tall = tall;
}
private String updateBy;
public Integer getTall()
{
return tall;
}
public void setWeight(Integer weight)
{
this.weight = weight;
}
public Integer getWeight()
{
return weight;
}
public void setPhysicalSignsId(String physicalSignsId)
{
this.physicalSignsId = physicalSignsId;
}
public String getPhysicalSignsId()
{
return physicalSignsId;
}
public void setDishesIngredientId(String dishesIngredientId)
{
this.dishesIngredientId = dishesIngredientId;
}
public String getDishesIngredientId()
{
return dishesIngredientId;
}
public void setPhoto(String photo)
{
this.photo = photo;
}
public String getPhoto()
{
return photo;
}
public void setConstipation(Integer constipation)
{
this.constipation = constipation;
}
public Integer getConstipation()
{
return constipation;
}
public void setStaylate(Integer staylate)
{
this.staylate = staylate;
}
public Integer getStaylate()
{
return staylate;
}
public void setMotion(Integer motion)
{
this.motion = motion;
}
public Integer getMotion()
{
return motion;
}
public void setMakeFoodType(Integer makeFoodType)
{
this.makeFoodType = makeFoodType;
}
public Integer getMakeFoodType()
{
return makeFoodType;
}
public void setMakeFoodTaste(Integer makeFoodTaste)
{
this.makeFoodTaste = makeFoodTaste;
}
public Integer getMakeFoodTaste()
{
return makeFoodTaste;
}
public void setWalk(Integer walk)
{
this.walk = walk;
}
public Integer getWalk()
{
return walk;
}
public void setDifficulty(String difficulty)
{
this.difficulty = difficulty;
}
public String getDifficulty()
{
return difficulty;
}
public void setWeakness(Integer weakness)
{
this.weakness = weakness;
}
public Integer getWeakness()
{
return weakness;
}
public void setRebound(Integer rebound)
{
this.rebound = rebound;
}
public Integer getRebound()
{
return rebound;
}
public void setCrux(Integer crux)
{
this.crux = crux;
}
public Integer getCrux()
{
return crux;
}
public void setPosition(Integer position)
{
this.position = position;
}
public Integer getPosition()
{
return position;
}
public void setSleepTime(Integer sleepTime)
{
this.sleepTime = sleepTime;
}
public Integer getSleepTime()
{
return sleepTime;
}
public void setGetupTime(Integer getupTime)
{
this.getupTime = getupTime;
}
public Integer getGetupTime()
{
return getupTime;
}
public void setConnectTime(Integer connectTime)
{
this.connectTime = connectTime;
}
public Integer getConnectTime()
{
return connectTime;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
public void setBloodData(String bloodData)
{
this.bloodData = bloodData;
}
public String getBloodData()
{
return bloodData;
}
public void setMoistureDate(String moistureDate)
{
this.moistureDate = moistureDate;
}
public String getMoistureDate()
{
return moistureDate;
}
public String getVocation() {
return vocation;
}
public void setVocation(String vocation) {
this.vocation = vocation;
}
public Integer getNight() {
return night;
}
public void setNight(Integer night) {
this.night = night;
}
public String getExperience() {
return experience;
}
public void setExperience(String experience) {
this.experience = experience;
}
public List<SysPhysicalSigns> getSignList() {
return signList;
}
public void setSignList(List<SysPhysicalSigns> signList) {
this.signList = signList;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("customerId", getCustomerId())
.append("sex", getSex())
.append("age", getAge())
.append("tall", getTall())
.append("weight", getWeight())
.append("physicalSignsId", getPhysicalSignsId())
.append("dishesIngredientId", getDishesIngredientId())
.append("photo", getPhoto())
.append("constipation", getConstipation())
.append("staylate", getStaylate())
.append("motion", getMotion())
.append("makeFoodType", getMakeFoodType())
.append("makeFoodTaste", getMakeFoodTaste())
.append("walk", getWalk())
.append("difficulty", getDifficulty())
.append("weakness", getWeakness())
.append("rebound", getRebound())
.append("crux", getCrux())
.append("position", getPosition())
.append("sleepTime", getSleepTime())
.append("getupTime", getGetupTime())
.append("connectTime", getConnectTime())
.append("remarks", getRemarks())
.append("bloodData", getBloodData())
.append("moistureDate", getMoistureDate())
.append("vocation", getVocation())
.append(" night", getNight())
.append("experience", getExperience())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.toString();
}
}

View File

@ -118,12 +118,14 @@
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
<result property="avoidFood" column="avoid_food" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler" />
<!-- column是传的参数, select是调用的查询 -->
<association property="signList" column="physical_signs_id" select="getSignByIds"/>
</resultMap>
<sql id="selectSysCustomerHealthyVo">
select sch.id, customer_id, conditioning_project_id, sex, age, weight, tall, condiment, other_condiment, cooking_style, cooking_style_rate, wash_vegetables_style, other_wash_vegetables_style, breakfast_type, breakfast_food, lunch_type, dinner, vegetable_rate, common_meat, dinner_time, supper_num, supper_food, diet_hot_and_cold, diet_flavor, vegetables_num, vegetables_rate_type, fruits_num, fruits_time, fruits_rate, rice_num, rice_full, eating_speed, snacks, other_snacks, health_products_flag, health_products_brand, health_products_name, health_products_week_rate, health_products_day_rate, water_num, water_type, water_habit, drinks_num, drink_wine_flag, drink_wine_classify, other_wine_classify, drink_wine_amount, smoke_flag, smoke_rate, second_smoke, work_industry, work_type, defecation_num, other_defecation_num, defecation_time, defecation_shape, defecation_smell, defecation_speed, defecation_color, motion_num, motion_duration, motion_time, aerobic_motion_classify, anaerobic_motion_classify, anaerobic_aerobic_motion_classify, other_motion_classify, motion_field, other_motion_field, sleep_time, sleep_quality, sleep_drug_flag, sleep_drug, stayup_late_flag, stayup_late_week_num, family_illness_history, other_family_illness_history, operation_history, other_operation_history, near_operation_flag, recoverye_situation, long_eat_drug_flag, long_eat_drug_classify, other_long_eat_drug_classify, allergy_flag, allergy_situation, allergen, other_allergen, medical_report, medical_report_name,
select sch.id, customer_id, avoid_food, conditioning_project_id, sex, age, weight, tall, condiment, other_condiment, cooking_style, cooking_style_rate, wash_vegetables_style, other_wash_vegetables_style, breakfast_type, breakfast_food, lunch_type, dinner, vegetable_rate, common_meat, dinner_time, supper_num, supper_food, diet_hot_and_cold, diet_flavor, vegetables_num, vegetables_rate_type, fruits_num, fruits_time, fruits_rate, rice_num, rice_full, eating_speed, snacks, other_snacks, health_products_flag, health_products_brand, health_products_name, health_products_week_rate, health_products_day_rate, water_num, water_type, water_habit, drinks_num, drink_wine_flag, drink_wine_classify, other_wine_classify, drink_wine_amount, smoke_flag, smoke_rate, second_smoke, work_industry, work_type, defecation_num, other_defecation_num, defecation_time, defecation_shape, defecation_smell, defecation_speed, defecation_color, motion_num, motion_duration, motion_time, aerobic_motion_classify, anaerobic_motion_classify, anaerobic_aerobic_motion_classify, other_motion_classify, motion_field, other_motion_field, sleep_time, sleep_quality, sleep_drug_flag, sleep_drug, stayup_late_flag, stayup_late_week_num, family_illness_history, other_family_illness_history, operation_history, other_operation_history, near_operation_flag, recoverye_situation, long_eat_drug_flag, long_eat_drug_classify, other_long_eat_drug_classify, allergy_flag, allergy_situation, allergen, other_allergen, medical_report, medical_report_name,
position,experience,rebound,difficulty,crux,dishes_ingredient,make_food_type,physical_signs_id,other_physical_signs,blood_data,moisture_date,sch.remark,sch.guidance,
sch.create_time, sch.create_by,sch. update_time, sch.update_by, sch.del_flag
</sql>
@ -268,6 +270,7 @@
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
<if test="avoidFood != null">avoid_food,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -377,6 +380,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="avoidFood != null">#{avoid_food, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
</trim>
</insert>
@ -489,6 +493,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="avoidFood != null">avoid_food = #{avoidFood, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
</trim>
where id = #{id}
</update>

View File

@ -33,6 +33,7 @@
<result property="getupTime" column="getup_time" />
<result property="connectTime" column="connect_time" />
<result property="remarks" column="remarks" />
<result property="remark" column="remark" />
<result property="bloodData" column="blood_data" />
<result property="moistureDate" column="moisture_date" />
<result property="vocation" column="vocation" />
@ -43,6 +44,7 @@
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="comments" column="comments"/>
<result property="avoidFood" column="avoid_food" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler" />
<!-- column是传的参数, select是调用的查询 -->
<association property="signList" column="physical_signs_id" select="getSignByIds"/>
</resultMap>
@ -50,7 +52,7 @@
<sql id="selectSysCustomerPhysicalSigns">
select scps.id,scps.customer_id,scps.sex, scps.age, scps.tall, scps.weight, scps.physical_signs_id, scps.dishes_ingredient_id, scps.photo, scps.constipation,
scps.stayLate, scps.motion, scps.make_food_type, scps.make_food_taste, scps.walk, scps.difficulty, scps.weakness, scps.rebound, scps.crux, scps.position,
scps.sleep_time, scps.getup_time, scps.connect_time, scps.remarks, scps.blood_data, scps.moisture_date, scps.vocation,
scps.sleep_time, scps.getup_time, scps.connect_time, scps.remarks, scps.remark, scps.avoid_food, scps.blood_data, scps.moisture_date, scps.vocation,
scps.night, scps.experience, scps.comments, scps.create_time, sc.name, sc.phone
from sys_customer_physical_signs scps
left join sys_customer sc on scps.customer_id = sc.id
@ -100,6 +102,7 @@
<if test="getupTime != null">getup_time,</if>
<if test="connectTime != null">connect_time,</if>
<if test="remarks != null">remarks,</if>
<if test="remark != null">remark,</if>
<if test="bloodData != null">blood_data,</if>
<if test="moistureDate != null">moisture_date,</if>
<if test="vocation != null">vocation,</if>
@ -110,6 +113,7 @@
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="avoidFood != null">avoid_food,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
@ -135,6 +139,7 @@
<if test="getupTime != null">#{getupTime},</if>
<if test="connectTime != null">#{connectTime},</if>
<if test="remarks != null">#{remarks},</if>
<if test="remark != null">#{remark},</if>
<if test="bloodData != null">#{bloodData},</if>
<if test="moistureDate != null">#{moistureDate},</if>
<if test="vocation != null">#{vocation},</if>
@ -145,6 +150,7 @@
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="avoidFood != null">#{avoid_food, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
</trim>
</insert>
@ -174,6 +180,7 @@
<if test="getupTime != null">getup_time = #{getupTime},</if>
<if test="connectTime != null">connect_time = #{connectTime},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="bloodData != null">blood_data = #{bloodData},</if>
<if test="moistureDate != null">moisture_date = #{moistureDate},</if>
<if test="vocation != null">vocation = #{vocation},</if>
@ -184,6 +191,7 @@
<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="avoidFood != null">avoid_food = #{avoidFood, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
</trim>
where id = #{id}
</update>

View File

@ -0,0 +1,147 @@
<template>
<div class="simple_igd_view_wrapper">
<el-row :gutter="12">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-col :span="8">
<el-form-item label="名称" prop="name" size="mini">
<el-input
v-model="queryParams.name"
placeholder="请输入食材名称"
clearable
size="mini"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="类别" prop="type" size="mini" width="130px">
<el-select
v-model="queryParams.type"
placeholder="请选择食材类别"
clearable
size="mini"
>
<el-option
v-for="dict in ingTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item size="mini">
<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-col>
</el-form>
</el-row>
<el-table
v-loading="loading"
border
:data="ingredientList"
:cell-style="{ padding: 0 }"
:header-cell-style="{ padding: 0, height: 'unset' }"
>
<el-table-column label="食材名称" align="center" prop="name" />
<el-table-column
label="食材类别"
align="center"
prop="type"
:formatter="typeFormat"
/>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleOnSelect(scope.row)"
>选用</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:background="false"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
layout="total, prev, pager, next"
/>
</div>
</template>
<script>
import { listIngredient } from "@/api/custom/ingredient";
export default {
name: "SimpleIngredientListView2",
data() {
return {
loading: false,
total: 0,
ingredientList: [],
ingTypeOptions: [],
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
area: null,
reviewStatus: "yes",
},
};
},
created() {
this.getDicts("cus_ing_type").then((response) => {
this.ingTypeOptions = response.data;
});
},
watch: {},
methods: {
getList() {
this.loading = true;
listIngredient(this.queryParams).then((response) => {
this.ingredientList = response.rows;
this.total = response.total;
this.loading = false;
});
},
reset() {
this.resetForm("queryForm");
},
//
typeFormat(row, column) {
return this.selectDictLabel(this.ingTypeOptions, row.type);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleOnSelect(data) {
this.$emit("onSelect", data);
},
},
};
</script>
<style lang="scss" scoped>
.simple_igd_view_wrapper {
/deep/ .el-input {
width: 130px;
}
}
</style>

View File

@ -0,0 +1,103 @@
<template>
<div class="avoid_certain_food_com_wrapper">
<el-popover
placement="right"
trigger="click"
width="600"
title="忌口"
@hide="handleOnHide"
>
<SimpleIngredientListView @onSelect="handleOnSelect" />
<span slot="reference" class="trigger">忌口 </span>
</el-popover>
<div class="content">
<el-tag
v-for="item in data"
:key="item.id"
closable
size="mini"
type="danger"
@close="handleOnClose(item)"
>
{{ item.name }}
</el-tag>
</div>
</div>
</template>
<script>
import { createNamespacedHelpers } from "vuex";
const { mapMutations } = createNamespacedHelpers("recipes");
import SimpleIngredientListView from "./SimpleIngredientListView";
import { editPhysicalSigns } from "@/api/custom/healthy";
export default {
name: "ACFCom2",
props: ["value", "id"],
components: {
SimpleIngredientListView,
},
data() {
return {
data: [],
};
},
watch: {
value(val) {
this.data = val;
},
},
methods: {
handleOnSelect(data) {
// console.log(data);
if (!this.data.some((obj) => obj.id === data.id)) {
this.data.push({
id: data.id,
name: data.name,
});
// console.log(this.data);
this.$emit("update:value", this.data);
this.updateAvoidFoodIds({
avoidFoodIds: this.data.map((obj) => obj.id),
});
}
},
handleOnClose(data) {
// console.log(data);
this.data = this.data.filter((obj) => data.id !== obj.id);
this.$emit("update:value", this.data);
this.updateAvoidFoodIds({ avoidFoodIds: this.data.map((obj) => obj.id) });
//
this.handleOnHide();
},
handleOnHide() {
editPhysicalSigns({ id: this.id, avoidFood: this.data }).then((res) => {
if (res.code === 200) {
this.$message.success("忌口修改成功");
}
});
},
...mapMutations(["updateAvoidFoodIds"]),
},
};
</script>
<style lang="scss" scoped>
.avoid_certain_food_com_wrapper {
display: flex;
margin-bottom: 8px;
.trigger {
font-size: 14px;
width: 42px;
color: #8c8c8c;
cursor: pointer;
}
.content {
flex: 1;
& > span {
margin: 0 4px 4px 4px;
}
}
}
</style>

View File

@ -0,0 +1,99 @@
<template>
<div class="simple_remark_com_wrapper">
<el-popover
placement="right"
trigger="click"
width="400"
title="备注"
@hide="handleOnHide"
>
<el-input
type="textarea"
v-model="nData"
rows="6"
placeholder="请输入备注信息"
maxlength="300"
show-word-limit
/>
<span slot="reference" class="trigger">备注 </span>
</el-popover>
<div class="content">
<span v-if="newLine">
<div v-for="v in mValue" :key="v">
{{ v }}
</div>
</span>
<span v-else>{{ mValue }}</span>
</div>
</div>
</template>
<script>
import { editPhysicalSigns } from "@/api/custom/healthy";
export default {
name: "RemarkCom2",
props: ["value", "id"],
components: {},
data() {
return {
newLine: false,
nData: "",
};
},
watch: {
value(val) {
this.nData = val;
},
nData(val) {
this.$emit("updata:value", val);
},
},
computed: {
mValue: function () {
if (
this.nData &&
typeof this.nData === "string" &&
(this.nData.includes("</br>") || this.nData.includes("\n"))
) {
this.newLine = true;
if (this.nData.includes("</br>")) {
return this.nData.split("</br>");
} else if (this.nData.includes("\n")) {
return this.nData.split("\n");
}
this.newLine = false;
return this.nData;
}
this.newLine = false;
return this.nData;
},
},
methods: {
handleOnHide() {
// console.log("handleOnHide");
editPhysicalSigns({ id: this.id, remark: this.nData }).then((res) => {
if (res.code === 200) {
this.$message.success("备注修改成功");
}
});
},
},
};
</script>
<style lang="scss" scoped>
.simple_remark_com_wrapper {
display: flex;
margin-bottom: 8px;
font-size: 14px;
.trigger {
width: 42px;
color: #8c8c8c;
cursor: pointer;
}
.content {
flex: 1;
}
}
</style>

View File

@ -1,15 +1,6 @@
<template>
<div class="body_sign_view_wrapper">
<div>
<h2>{{ this.data.name }}</h2>
<el-button
v-if="dev"
size="mini"
type="primary"
class="remark_btn"
@click="handleOnRemark"
>修改备注</el-button
>
<h2>{{ data.name }}</h2>
<div class="msg-info" v-for="(info, idx) in basicInfo" :key="idx">
<text-info
v-for="con in info"
@ -19,28 +10,14 @@
extraclass="text-info-extra"
/>
</div>
</div>
<!-- 备注弹窗 -->
<el-dialog title="修改备注" :visible.sync="open" width="480px">
<el-input
type="textarea"
v-model="data.remarks"
rows="6"
placeholder="请输入备注信息"
maxlength="300"
show-word-limit
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit"> </el-button>
<el-button @click="onClosed"> </el-button>
</div>
</el-dialog>
<RemarkCom2 v-if="dev" :value.sync="data.remark" :id="data.id" />
<ACFCOM2 v-if="dev" :value.sync="data.avoidFood" :id="data.id" />
</div>
</template>
<script>
import TextInfo from "@/components/TextInfo";
import { editPhysicalSigns } from "@/api/custom/healthy";
import ACFCOM2 from "./ACFCom2";
import RemarkCom2 from "./RemarkCom2";
export default {
name: "BodySignView",
@ -56,6 +33,8 @@ export default {
},
components: {
"text-info": TextInfo,
ACFCOM2,
RemarkCom2,
},
data() {
const basicInfo = [
@ -110,32 +89,11 @@ export default {
basicInfo.splice(6, 0, [
{ title: "不运动总热量", value: "notSportHeat" },
]);
basicInfo.splice(basicInfo.length, 0, [
{ title: "备注", value: "remarks" },
]);
}
return {
basicInfo,
open: false,
};
},
methods: {
handleOnRemark() {
this.open = true;
},
onClosed() {
this.open = false;
},
submit() {
const { id, remarks } = this.data;
editPhysicalSigns({ id, remarks }).then((res) => {
if (res.code === 200) {
this.$message.success("修改成功");
this.open = false;
}
});
},
},
};
</script>
<style lang="scss" scoped>

View File

@ -0,0 +1,147 @@
<template>
<div class="simple_igd_view_wrapper">
<el-row :gutter="12">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-col :span="8">
<el-form-item label="名称" prop="name" size="mini">
<el-input
v-model="queryParams.name"
placeholder="请输入食材名称"
clearable
size="mini"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="类别" prop="type" size="mini" width="130px">
<el-select
v-model="queryParams.type"
placeholder="请选择食材类别"
clearable
size="mini"
>
<el-option
v-for="dict in ingTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item size="mini">
<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-col>
</el-form>
</el-row>
<el-table
v-loading="loading"
border
:data="ingredientList"
:cell-style="{ padding: 0 }"
:header-cell-style="{ padding: 0, height: 'unset' }"
>
<el-table-column label="食材名称" align="center" prop="name" />
<el-table-column
label="食材类别"
align="center"
prop="type"
:formatter="typeFormat"
/>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleOnSelect(scope.row)"
>选用</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:background="false"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
layout="total, prev, pager, next"
/>
</div>
</template>
<script>
import { listIngredient } from "@/api/custom/ingredient";
export default {
name: "SimpleIngredientListView",
data() {
return {
loading: false,
total: 0,
ingredientList: [],
ingTypeOptions: [],
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
area: null,
reviewStatus: "yes",
},
};
},
created() {
this.getDicts("cus_ing_type").then((response) => {
this.ingTypeOptions = response.data;
});
},
watch: {},
methods: {
getList() {
this.loading = true;
listIngredient(this.queryParams).then((response) => {
this.ingredientList = response.rows;
this.total = response.total;
this.loading = false;
});
},
reset() {
this.resetForm("queryForm");
},
//
typeFormat(row, column) {
return this.selectDictLabel(this.ingTypeOptions, row.type);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleOnSelect(data) {
this.$emit("onSelect", data);
},
},
};
</script>
<style lang="scss" scoped>
.simple_igd_view_wrapper {
/deep/ .el-input {
width: 130px;
}
}
</style>

View File

@ -0,0 +1,107 @@
<template>
<div class="avoid_certain_food_com_wrapper">
<el-popover
placement="right"
trigger="click"
width="600"
title="忌口"
@hide="handleOnHide"
>
<SimpleIngredientListView @onSelect="handleOnSelect" />
<span slot="reference" class="trigger">忌口 </span>
</el-popover>
<div class="content">
<el-tag
v-for="item in data"
:key="item.id"
closable
size="mini"
type="danger"
@close="handleOnClose(item)"
>
{{ item.name }}
</el-tag>
</div>
</div>
</template>
<script>
import { createNamespacedHelpers } from "vuex";
const {
mapActions,
mapState,
mapMutations,
mapGetters,
} = createNamespacedHelpers("recipes");
import SimpleIngredientListView from "./SimpleIngredientListView";
import { updateHealthy } from "@/api/custom/healthy";
export default {
name: "ACFCom",
props: ["value", "id"],
components: {
SimpleIngredientListView,
},
data() {
return {
data: [],
};
},
watch: {
value(val) {
this.data = val;
},
},
methods: {
handleOnSelect(data) {
// console.log(data);
if (!this.data.some((obj) => obj.id === data.id)) {
this.data.push({
id: data.id,
name: data.name,
});
// console.log(this.data);
this.$emit("update:value", this.data);
this.updateAvoidFoodIds({
avoidFoodIds: this.data.map((obj) => obj.id),
});
}
},
handleOnClose(data) {
// console.log(data);
this.data = this.data.filter((obj) => data.id !== obj.id);
this.$emit("update:value", this.data);
this.updateAvoidFoodIds({ avoidFoodIds: this.data.map((obj) => obj.id) });
//
this.handleOnHide();
},
handleOnHide() {
updateHealthy({ id: this.id, avoidFood: this.data }).then((res) => {
if (res.code === 200) {
this.$message.success("忌口修改成功");
}
});
},
...mapMutations(["updateAvoidFoodIds"]),
},
};
</script>
<style lang="scss" scoped>
.avoid_certain_food_com_wrapper {
display: flex;
margin-bottom: 8px;
.trigger {
font-size: 14px;
width: 42px;
color: #8c8c8c;
cursor: pointer;
}
.content {
flex: 1;
& > span {
margin: 0 4px 4px 4px;
}
}
}
</style>

View File

@ -0,0 +1,99 @@
<template>
<div class="simple_remark_com_wrapper">
<el-popover
placement="right"
trigger="click"
width="400"
title="备注"
@hide="handleOnHide"
>
<el-input
type="textarea"
v-model="nData"
rows="6"
placeholder="请输入备注信息"
maxlength="300"
show-word-limit
/>
<span slot="reference" class="trigger">备注 </span>
</el-popover>
<div class="content">
<span v-if="newLine">
<div v-for="v in mValue" :key="v">
{{ v }}
</div>
</span>
<span v-else>{{ mValue }}</span>
</div>
</div>
</template>
<script>
import { updateHealthy } from "@/api/custom/healthy";
export default {
name: "RemarkCom",
props: ["value", "id"],
components: {},
data() {
return {
newLine: false,
nData: "",
};
},
watch: {
value(val) {
this.nData = val;
},
nData(val) {
this.$emit("updata:value", val);
},
},
computed: {
mValue: function () {
if (
this.nData &&
typeof this.nData === "string" &&
(this.nData.includes("</br>") || this.nData.includes("\n"))
) {
this.newLine = true;
if (this.nData.includes("</br>")) {
return this.nData.split("</br>");
} else if (this.nData.includes("\n")) {
return this.nData.split("\n");
}
this.newLine = false;
return this.nData;
}
this.newLine = false;
return this.nData;
},
},
methods: {
handleOnHide() {
// console.log("handleOnHide");
updateHealthy({ id: this.id, remark: this.nData }).then((res) => {
if (res.code === 200) {
this.$message.success("备注修改成功");
}
});
},
},
};
</script>
<style lang="scss" scoped>
.simple_remark_com_wrapper {
display: flex;
margin-bottom: 8px;
font-size: 14px;
.trigger {
width: 42px;
color: #8c8c8c;
cursor: pointer;
}
.content {
flex: 1;
}
}
</style>

View File

@ -2,14 +2,6 @@
<div class="health_view_wrapper">
<div>
<h2>{{ this.data.name }}</h2>
<el-button
v-if="dev"
size="mini"
type="primary"
class="remark_btn"
@click="handleOnRemark"
>修改备注</el-button
>
<div class="msg-info" v-for="(info, idx) in basicInfo" :key="idx">
<text-info
v-for="i in info"
@ -19,6 +11,8 @@
extraclass="text-info-extra"
/>
</div>
<RemarkCom v-if="dev" :value.sync="data.remark" :id="data.id" />
<ACFCom v-if="dev" :value.sync="data.avoidFood" :id="data.id" />
</div>
<el-collapse>
<el-collapse-item
@ -47,27 +41,12 @@
</div>
</el-collapse-item>
</el-collapse>
<!-- 备注弹窗 -->
<el-dialog title="修改备注" :visible.sync="open" width="480px">
<el-input
type="textarea"
v-model="data.remark"
rows="6"
placeholder="请输入备注信息"
maxlength="300"
show-word-limit
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit"> </el-button>
<el-button @click="onClosed"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import TextInfo from "@/components/TextInfo";
import { updateHealthy } from "@/api/custom/healthy";
import ACFCom from "./ACFCom";
import RemarkCom from "./RemarkCom";
export default {
name: "HealthyView",
@ -83,6 +62,8 @@ export default {
},
components: {
"text-info": TextInfo,
ACFCom,
RemarkCom,
},
data() {
const basicInfo = [
@ -107,13 +88,9 @@ export default {
basicInfo.splice(6, 0, [
{ title: "不运动总热量", value: "notSportHeat" },
]);
basicInfo.splice(basicInfo.length, 0, [
{ title: "备注", value: "remark" },
]);
}
return {
open: false,
basicInfo,
healthyInvestigate: [
{
@ -243,21 +220,6 @@ export default {
getImgUrl(path) {
return `${window.location.origin}${path}`;
},
handleOnRemark() {
this.open = true;
},
onClosed() {
this.open = false;
},
submit() {
const { id, remark } = this.data;
updateHealthy({ id, remark }).then((res) => {
if (res.code === 200) {
this.$message.success("修改成功");
this.open = false;
}
});
},
},
};
</script>

View File

@ -29,8 +29,10 @@ export default {
} else if (this.value.includes("\n")) {
return this.value.split("\n");
}
this.newLine = false;
return this.value;
}
this.newLine = false;
return this.value;
},
},

View File

@ -39,6 +39,7 @@ const oriState = {
//
leftShow: false,
notRecIgds: [],
avoidFoodIds: [],
igdTypeOptions: []
};
@ -75,6 +76,9 @@ const mutations = {
}
}
},
updateAvoidFoodIds(state, payload) {
state.avoidFoodIds = payload.avoidFoodIds;
},
updateFontSize(state, payload) {
state.fontSize = payload.fontSize;
localStorage.setItem("fontSize", payload.fontSize);
@ -215,7 +219,8 @@ const actions = {
commit("updateStateData", {
healthDataLoading: false,
healthyDataType,
healthyData
healthyData,
avoidFoodIds: (healthyData.avoidFood || []).map(obj => obj.id)
});
},
async getRecipesInfo({ commit, state }, payload) {

View File

@ -311,6 +311,9 @@ export default {
return {};
},
computed: {
notIds() {
return this.avoidFoodIds.concat(this.notRecIgds);
},
mData() {
if (!this.data.dishes) {
return [];
@ -337,7 +340,7 @@ export default {
}
lastNameHit =
arr[arr.length - 1].name === cur.name &&
arr[arr.length - 1].type === cur.type
arr[arr.length - 1].type === cur.type;
// arr[arr.length - 1].dishesId === cur.dishesId;
if (lastNameHit) {
let namePos = arr.length - 1;
@ -407,6 +410,7 @@ export default {
"canCopyMenuTypes",
"recipesId",
"notRecIgds",
"avoidFoodIds",
]),
},
methods: {
@ -416,7 +420,7 @@ export default {
return "recipes_first_col";
} else {
return `recipes_cell recipes_cell_${this.fontSize} ${
columnIndex === 2 && this.notRecIgds.includes(row.igdId)
columnIndex === 2 && this.notIds.includes(row.igdId)
? "warning_heightlight"
: ""
}`;