修复通俗重量

This commit is contained in:
huangdeliang 2021-02-09 10:25:34 +08:00
parent f8f40dc91c
commit afb7465281
26 changed files with 580 additions and 333 deletions

View File

@ -1,16 +1,11 @@
package com.stdiet.web.controller.custom;
import java.util.List;
import com.github.pagehelper.PageHelper;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
@ -38,7 +33,7 @@ public class SysIngredientController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('custom:ingredient:list')")
@PostMapping("/list")
public TableDataInfo list(@RequestBody SysIngredient sysIngredient)
public TableDataInfo list(@RequestParam Integer pageSize, @RequestParam Integer pageNum, @RequestBody SysIngredient sysIngredient)
{
startPage();
List<SysIngredient> list = sysIngredientService.selectSysIngredientList(sysIngredient);

View File

@ -0,0 +1,23 @@
package com.stdiet.web.controller.custom;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.custom.service.ISysRecipesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/recipes")
public class SysRecipesController extends BaseController {
@Autowired
private ISysRecipesService sysRecipesService;
@GetMapping(value = "/{resipesId}")
public AjaxResult getInfo(@PathVariable("resipesId") Long resipesId) {
return AjaxResult.success(sysRecipesService.selectSysRecipesByRecipesId(resipesId));
}
}

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.fasterxml.jackson.annotation.JsonFormat;
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,22 +13,30 @@ import java.util.List;
* @author wonder
* @date 2020-12-28
*/
public class SysDishes extends BaseEntity
{
@Data
public class SysDishes {
private static final long serialVersionUID = 1L;
/** id */
/**
* id
*/
private Long id;
/** 菜品名称 */
/**
* 菜品名称
*/
@Excel(name = "菜品名称")
private String name;
/** 菜品类型 */
/**
* 菜品类型
*/
@Excel(name = "菜品类型")
private String type;
/** 做法 */
/**
* 做法
*/
@Excel(name = "做法")
private String methods;
@ -36,80 +44,36 @@ public class SysDishes extends BaseEntity
private String reviewStatus;
public Integer getIsMain() {
return isMain;
}
/**
* 创建者
*/
private String createBy;
public void setIsMain(Integer isMain) {
this.isMain = isMain;
}
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
public void setReviewStatus(String reviewStatus) {
this.reviewStatus = reviewStatus;
}
/**
* 更新者
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 备注
*/
private String remark;
public String getReviewStatus() {
return reviewStatus;
}
private List<SysDishesIngredient> igdList;
public void setId(Long id)
{
this.id = id;
}
private List<SysDishesIngredient> detail;
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setMethods(String methods)
{
this.methods = methods;
}
public String getMethods()
{
return methods;
}
public void setIgdList(List<SysDishesIngredient> ingredientList) {
this.igdList = ingredientList;
}
public List<SysDishesIngredient> getIgdList() {
return igdList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("type", getType())
.append("methods", getMethods())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -21,9 +21,9 @@ public class SysDishesIngredient extends SysIngredient {
private Long cusUnit;
private BigDecimal cusWeight;
// private BigDecimal cusWeight;
private Integer cusWei;
private Integer cusWeight;
private BigDecimal weight;

View File

@ -0,0 +1,25 @@
package com.stdiet.custom.domain;
import lombok.Data;
/**
* 食材对象 sys_ingredient
*
* @author wonder
* @date 2020-12-15
*/
@Data
public class SysDishesIngredientInfo {
private static final long serialVersionUID = 1L;
private Long id;
private String cus_unit;
private String cus_weight;
private Integer weight;
private String remark;
}

View File

@ -1,11 +1,11 @@
package com.stdiet.custom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 食材对象 sys_ingredient
@ -13,12 +13,10 @@ import java.math.BigDecimal;
* @author wonder
* @date 2020-12-15
*/
public class SysIngredient extends BaseEntity {
@Data
public class SysIngredient {
private static final long serialVersionUID = 1L;
private int pageNum;
private int pageSize;
/**
* id
*/
@ -77,131 +75,36 @@ public class SysIngredient extends BaseEntity {
*/
private String reviewStatus;
public void setReviewStatus(String reviewStatus) {
this.reviewStatus = reviewStatus;
}
/**
* 创建者
*/
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;
public String getReviewStatus() {
return reviewStatus;
}
private Long[] recIds;
private Long[] notRecIds;
public Long[] getRecIds() {
return recIds;
}
public Long[] getNotRecIds() {
return notRecIds;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public BigDecimal getProteinRatio() {
return proteinRatio;
}
public void setProteinRatio(BigDecimal proteinRatio) {
this.proteinRatio = proteinRatio;
}
public BigDecimal getFatRatio() {
return fatRatio;
}
public void setFatRatio(BigDecimal fatRatio) {
this.fatRatio = fatRatio;
}
public BigDecimal getCarbonRatio() {
return carbonRatio;
}
public void setCarbonRatio(BigDecimal carbonRatio) {
this.carbonRatio = carbonRatio;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getNotRec() {
return notRec;
}
public void setNotRec(String notRec) {
this.notRec = notRec;
}
public String getRec() {
return rec;
}
public void setRec(String rec) {
this.rec = rec;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageNum() {
return pageNum;
}
public int getPageSize() {
return pageSize;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("type", getType())
.append("proteinRatio", getProteinRatio())
.append("fatRatio", getFatRatio())
.append("carbonRatio", getCarbonRatio())
.append("remark", getRemark())
.append("area", getArea())
.append("notRec", getNotRec())
.append("recommend", getRec())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,47 @@
package com.stdiet.custom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class SysRecipes {
private static final long serialVersionUID = 1L;
private Long id;
private Integer numDay;
private List<SysDishes> dishes;
private Integer reviewStatus;
/**
* 创建者
*/
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;
}

View File

@ -0,0 +1,10 @@
package com.stdiet.custom.mapper;
import com.stdiet.custom.domain.SysRecipes;
import java.util.List;
public interface SysRecipesMapper {
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
}

View File

@ -0,0 +1,9 @@
package com.stdiet.custom.service;
import com.stdiet.custom.domain.SysRecipes;
import java.util.List;
public interface ISysRecipesService {
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
}

View File

@ -0,0 +1,23 @@
package com.stdiet.custom.service.impl;
import com.stdiet.custom.domain.SysRecipes;
import com.stdiet.custom.mapper.SysRecipesMapper;
import com.stdiet.custom.service.ISysRecipesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class SysRecipesServiceImpl implements ISysRecipesService {
@Autowired
private SysRecipesMapper sysRecipesMapper;
@Override
public List<SysRecipes> selectSysRecipesByRecipesId(Long id) {
return sysRecipesMapper.selectSysRecipesByRecipesId(id);
}
}

View File

@ -0,0 +1,56 @@
package com.stdiet.custom.typehandler;
import com.alibaba.fastjson.JSONArray;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by lixio on 2019/3/28 20:51
* @description 用以mysql中json格式的字段进行转换的自定义转换器转换为实体类的JSONArray属性
* MappedTypes注解中的类代表此转换器可以自动转换为的java对象
* MappedJdbcTypes注解中设置的是对应的jdbctype
*/
@MappedTypes(JSONArray.class)
@MappedJdbcTypes(JdbcType.VARCHAR)
public class ArrayJsonHandler extends BaseTypeHandler<JSONArray> {
//设置非空参数
@Override
public void setNonNullParameter(PreparedStatement ps, int i, JSONArray parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, String.valueOf(parameter.toJSONString()));
}
//根据列名获取可以为空的结果
@Override
public JSONArray getNullableResult(ResultSet rs, String columnName) throws SQLException {
String sqlJson = rs.getString(columnName);
if (null != sqlJson){
return JSONArray.parseArray(sqlJson);
}
return null;
}
//根据列索引获取可以为空的结果
@Override
public JSONArray getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String sqlJson = rs.getString(columnIndex);
if (null != sqlJson){
return JSONArray.parseArray(sqlJson);
}
return null;
}
@Override
public JSONArray getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
String sqlJson = cs.getString(columnIndex);
if (null != sqlJson){
return JSONArray.parseArray(sqlJson);
}
return null;
}
}

View File

@ -0,0 +1,57 @@
package com.stdiet.custom.typehandler;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by lixio on 2019/3/28 15:44
* @description 用以mysql中json格式的字段进行转换的自定义转换器转换为实体类的JSONObject属性
* MappedTypes注解中的类代表此转换器可以自动转换为的java对象
* MappedJdbcTypes注解中设置的是对应的jdbctype
*/
@MappedTypes(JSONObject.class)
@MappedJdbcTypes(JdbcType.VARCHAR)
public class ObjectJsonHandler extends BaseTypeHandler<JSONObject>{
//设置非空参数
@Override
public void setNonNullParameter(PreparedStatement ps, int i, JSONObject parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, String.valueOf(parameter.toJSONString()));
}
//根据列名获取可以为空的结果
@Override
public JSONObject getNullableResult(ResultSet rs, String columnName) throws SQLException {
String sqlJson = rs.getString(columnName);
if (null != sqlJson){
return JSONObject.parseObject(sqlJson);
}
return null;
}
//根据列索引获取可以为空的结果
@Override
public JSONObject getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String sqlJson = rs.getString(columnIndex);
if (null != sqlJson){
return JSONObject.parseObject(sqlJson);
}
return null;
}
@Override
public JSONObject getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
String sqlJson = cs.getString(columnIndex);
if (null != sqlJson){
return JSONObject.parseObject(sqlJson);
}
return null;
}
}

View File

@ -28,7 +28,6 @@
<result property="rec" column="rec" />
<result property="notRec" column="not_rec" />
<result property="cusWeight" column="cus_weight" />
<result property="cusWei" column="cus_wei" />
<result property="cusUnit" column="cus_unit" />
<result property="weight" column="weight" />
</resultMap>
@ -49,7 +48,7 @@
<sql id="selectSysIngreditentsByIdVo">
SELECT * FROM(
SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_wei, cus_unit, remark
SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_unit, remark
FROM sys_dishes_ingredient
WHERE dishes_id = #{id}
) dishes
@ -149,9 +148,9 @@
</delete>
<insert id="bashInsertDishesIngredent">
insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_wei, remark) values
insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_weight, remark) values
<foreach collection="list" separator="," item="item" index="index">
(#{item.dishesId}, #{item.ingredientId}, #{item.weight}, #{item.cusUnit}, #{item.cusWei}, #{item.remark})
(#{item.dishesId}, #{item.ingredientId}, #{item.weight}, #{item.cusUnit}, #{item.cusWeight}, #{item.remark})
</foreach>
</insert>

View File

@ -0,0 +1,76 @@
<?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.SysRecipesMapper">
<resultMap type="SysRecipes" id="SysRecipesResult">
<result property="id" column="id"/>
<result property="numDay" column="num_day"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="reviewStatus" column="review_status"/>
<association property="dishes" column="id" select="selectDishesByMenuId"/>
</resultMap>
<resultMap id="SysDishesResult" type="SysDishes">
<result property="id" column="dishes_id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="methods" column="methods"/>
<result property="isMain" column="is_main"/>
<result property="detail" column="detail" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"
javaType="com.stdiet.custom.domain.SysDishesIngredientInfo"/>
<association property="igdList" column="dishes_id" select="selectIngredientsByDishesId"/>
</resultMap>
<resultMap id="SysIgdsResult" type="SysDishesIngredient">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="proteinRatio" column="protein_ratio"/>
<result property="fatRatio" column="fat_ratio"/>
<result property="carbonRatio" column="carbon_ratio"/>
<result property="area" column="area"/>
<result property="rec" column="rec"/>
<result property="notRec" column="not_rec"/>
</resultMap>
<select id="selectSysRecipesByRecipesId" parameterType="Long" resultMap="SysRecipesResult">
SELECT * FROM sys_customer_daily_menu WHERE recipes_id = #{id}
</select>
<select id="selectDishesByMenuId" parameterType="Long" resultMap="SysDishesResult">
SELECT * FROM (SELECT * FROM sys_customer_menu_dishes WHERE menu_id = #{id}) AS menu
LEFT JOIN sys_dishes ON menu.dishes_id = sys_dishes.id
</select>
<select id="selectIngredientsByDishesId" parameterType="Long" resultMap="SysIgdsResult">
SELECT * FROM(
SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_unit, remark
FROM sys_dishes_ingredient
WHERE dishes_id = #{id}
) dishes
LEFT JOIN (
SELECT id, name, type, protein_ratio, fat_ratio, carbon_ratio, area, not_rec, rec
FROM sys_ingredient igd
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_not_rec
) notRec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) notRecT USING(id)
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_rec
) rec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) recT USING(id)
) ing USING(id)
</select>
</mapper>

View File

@ -4,7 +4,7 @@ import request from '@/utils/request'
export function listIngredient(query) {
const {recIds, notRecIds} = query;
return request({
url: '/custom/ingredient/list',
url: `/custom/ingredient/list?pageSize=${query.pageSize}&pageNum=${query.pageNum}`,
method: 'post',
data: {
...query,

View File

@ -0,0 +1,25 @@
<template>
<div class="main">
<div class="aspect">指标</div>
<div class="recipes">食谱</div>
</div>
</template>
<script>
export default {
name: "RecipesView",
components: {},
data() {
return {};
},
methods: {},
};
</script>
<style rel="stylesheet/scss" lang="scss">
.main {
.aspect {
}
.recipies {
}
}
</style>

View File

@ -145,7 +145,7 @@ export const constantRoutes = [
hidden: true,
children: [
{
path: "build/:cusId/:id(\\d+)",
path: "build/:cusId/:planId/:recipesId",
component: resolve =>
require(["@/views/custom/recipesBuild"], resolve),
name: "RecipiesBuild",

View File

@ -1,13 +1,15 @@
import Vue from 'vue'
import Vuex from 'vuex'
import app from './modules/app'
import user from './modules/user'
import tagsView from './modules/tagsView'
import permission from './modules/permission'
import settings from './modules/settings'
import getters from './getters'
import Vue from "vue";
import Vuex from "vuex";
import app from "./modules/app";
import user from "./modules/user";
import tagsView from "./modules/tagsView";
import permission from "./modules/permission";
import settings from "./modules/settings";
import recipes from "./modules/recipes";
Vue.use(Vuex)
import getters from "./getters";
Vue.use(Vuex);
const store = new Vuex.Store({
modules: {
@ -15,9 +17,10 @@ const store = new Vuex.Store({
user,
tagsView,
permission,
settings
settings,
recipes
},
getters
})
});
export default store
export default store;

View File

@ -0,0 +1,50 @@
import { getOrder } from "@/api/custom/order";
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import { dealHealthy } from "@/utils/healthyData";
import { getRecipesPlan } from "@/api/custom/recipesPlan";
const oriState = {
healthyData: {},
healthyDataType: 0
};
const mutations = {
setHealtyData(state, payload) {
state.healthyDataType = payload.healthyDataType;
state.healthyData = payload.healthyData;
},
clean(state) {
console.log("clean");
Object.keys(oriState).forEach(key => {
state[key] = oriState[key];
});
}
};
const actions = {
async init({ commit }, payload) {
const orderResult = await getOrder(payload.cusId);
if (!orderResult.data.cusId) {
throw new Error("未找到用户id");
}
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
orderResult.data.cusId
);
// 设置健康数据
commit("setHealtyData", {
healthyDataType: healthyDataResult.data.type,
healthyData: dealHealthy(healthyDataResult.data.customerHealthy)
});
}
};
const getters = {};
export default {
namespaced: true,
state: Object.assign({}, oriState),
mutations,
actions,
getters
};

View File

@ -258,7 +258,7 @@
step="0.5"
:min="0.5"
/> -->
<el-select size="mini" v-model="scope.row.cusWei">
<el-select size="mini" v-model="scope.row.cusWeight">
<el-option
v-for="dict in cusWeightOptions"
:key="dict.dictValue"
@ -502,7 +502,7 @@ export default {
return this.selectDictLabel(this.cusUnitOptions, row.type);
},
cusWeightFormat(row, column) {
return this.selectDictLabel(this.cusWeightOptions, row.cusWei);
return this.selectDictLabel(this.cusWeightOptions, row.cusWeight);
},
//
reviewStatusFormat(row, column) {
@ -686,7 +686,7 @@ export default {
newTableData.push({
...tmpTableObj,
weight: 100,
cusWei: 1,
cusWeight: 1,
cusUnit: 1,
});
}

View File

@ -77,12 +77,13 @@ export default {
},
};
</script>
<style scoped>
<style rel="stylesheet/scss" lang="scss">
.msg-info {
display: flex;
margin-bottom: 8px;
}
.text-info-extra {
margin-bottom: 2px;
.text-info-extra {
margin-bottom: 2px;
}
}
</style>

View File

@ -181,12 +181,13 @@ export default {
},
};
</script>
<style scoped>
<style rel="stylesheet/scss" lang="scss">
.msg-info {
display: flex;
margin-bottom: 8px;
}
.text-info-extra {
margin-bottom: 2px;
.text-info-extra {
margin-bottom: 2px;
}
}
</style>

View File

@ -32,21 +32,21 @@ export default {
props: ["title", "value", "extraclass"],
};
</script>
<style scoped>
<style rel="stylesheet/scss" lang="scss">
.text_info_wrapper {
display: flex;
margin-right: 24px;
min-width: 120px;
font-size: 14px;
}
.text_info_wrapper .title {
color: #8c8c8c;
width: auto;
}
.title {
color: #8c8c8c;
width: auto;
}
.text_info_wrapper .value {
/* color: #696969; */
flex: 1;
.value {
/* color: #696969; */
flex: 1;
}
}
</style>

View File

@ -10,10 +10,11 @@
</div>
</template>
<script>
import { getRecipesPlan } from "@/api/custom/recipesPlan";
import { getOrder } from "@/api/custom/order";
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import { dealHealthy } from "@/utils/healthyData";
import { createNamespacedHelpers } from "vuex";
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
"recipes"
);
import HealthyView from "./HealthyView";
import BodySignView from "./BodySignView";
@ -21,47 +22,54 @@ import BodySignView from "./BodySignView";
export default {
name: "BuildRecipies",
data() {
return {
healthyData: {},
healthyDataType: 0,
};
return {};
},
created() {
getOrder(this.cusId).then((res) => {
if (!res.data.cusId) {
this.$message.error("未找到用户id");
return;
}
getCustomerPhysicalSignsByCusId(res.data.cusId).then((iRes) => {
this.healthyDataType = iRes.data.type;
this.healthyData = dealHealthy(iRes.data.customerHealthy);
// console.log(this.healthyData);
});
mounted() {
//
console.log({
cusId: this.cusId,
recipesId: this.recipesId,
});
this.init({ cusId: this.cusId }).catch((err) => {
this.$message.error(err.message);
});
},
destroyed() {
this.clean();
},
created() {},
components: {
HealthyView,
BodySignView,
},
props: ["id", "cusId"],
methods: {},
props: ["planId", "cusId", "recipesId"],
computed: {
...mapState({
healthyData: (state) => state.healthyData,
healthyDataType: (state) => state.healthyDataType,
}),
},
methods: {
...mapActions(["init"]),
...mapMutations(["clean"]),
},
};
</script>
<style>
<style rel="stylesheet/scss" lang="scss">
.content {
display: flex;
height: calc(100vh - 124px);
}
.content .left {
flex: 4;
border-right: 1px solid rgb(0 21 41 / 8%);
height: 100%;
overflow: auto;
}
.content .right {
flex: 1;
height: 100%;
padding-left: 20px;
overflow: auto;
.left {
flex: 4;
border-right: 1px solid #e6ebf5;
height: 100%;
overflow: auto;
}
.right {
flex: 1;
height: 100%;
padding-left: 20px;
overflow: auto;
}
}
</style>

View File

@ -1,38 +0,0 @@
<template>
<div class="app-container">
<div class="content">
<div class="left"></div>
<div class="right"></div>
</div>
</div>
</template>
<script>
import { getRecipesPlan } from "@/api/custom/recipesPlan";
import { getOrder } from "@/api/custom/order";
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
export default {
name: "BuildRecipies",
data() {
return {
healthyData: {},
};
},
created() {
getOrder(this.cusId).then((res) => {
console.log(res);
getCustomerPhysicalSignsByCusId(res.data.cusId).then((iRes) => {
this.healthyData = iRes.data;
});
});
},
components: {},
props: ["id", "cusId"],
methods: {},
};
</script>
<style>
.content .left {
}
.content .right {
}
</style>

View File

@ -198,7 +198,7 @@
type="text"
icon="el-icon-edit"
@click="handleBuild(scope.row)"
>制作食谱</el-button
>{{ `${scope.row.recipes_id ? "编辑" : "制作"}食谱` }}</el-button
>
</template>
</el-table-column>
@ -604,10 +604,20 @@ export default {
}
},
handleBuild(data) {
this.$router.push({
name: "RecipiesBuild",
params: { id: data.id, cusId: data.orderId },
});
// const params = { id: data.id, cusId: data.orderId };
let path = `/recipes/build/${data.orderId}/${data.id}`;
if (data.recipes_id) {
// params.recipesId = data.recipes_id;
path += `/${data.recipes_id}`;
}
// test
// params.recipesId = "61";
path += '/61';
// this.$router.push({
// name: "build",
// params,
// });
this.$router.push(path);
},
},
};