diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFoodHeatStatisticsController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFoodHeatStatisticsController.java index 4e9350315..7307e2008 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFoodHeatStatisticsController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFoodHeatStatisticsController.java @@ -30,7 +30,6 @@ public class SysFoodHeatStatisticsController extends BaseController /** * 查询外食热量统计列表 */ - @PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:list')") @GetMapping("/list") public TableDataInfo list(SysCustomerHeatStatistics sysCustomerHeatStatistics) { diff --git a/stdiet-ui/src/components/BodySignView/index.vue b/stdiet-ui/src/components/BodySignView/index.vue index b7f1cdffc..ed5c404dd 100644 --- a/stdiet-ui/src/components/BodySignView/index.vue +++ b/stdiet-ui/src/components/BodySignView/index.vue @@ -104,9 +104,10 @@ export default { [{ title: "方便沟通时间", value: "connectTime" }], ]; if (this.dev) { - basicInfo.splice(3, 0, [{ title: "蛋白范围", value: "recProtein" }]); - basicInfo.splice(4, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]); - basicInfo.splice(5, 0, [ + basicInfo.splice(3, 0, [{ title: "BMI", value: "bmi" }]); + basicInfo.splice(4, 0, [{ title: "蛋白范围", value: "recProtein" }]); + basicInfo.splice(5, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]); + basicInfo.splice(6, 0, [ { title: "不运动总热量", value: "notSportHeat" }, ]); basicInfo.splice(basicInfo.length, 0, [ diff --git a/stdiet-ui/src/components/HealthyView/index.vue b/stdiet-ui/src/components/HealthyView/index.vue index 3f33b25fe..298d9abac 100644 --- a/stdiet-ui/src/components/HealthyView/index.vue +++ b/stdiet-ui/src/components/HealthyView/index.vue @@ -90,12 +90,15 @@ export default { [{ title: "地域", value: "position" }], ]; if (this.dev) { - basicInfo.splice(3, 0, [{ title: "推荐蛋白范围", value: "recProtein" }]); - basicInfo.splice(4, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]); - basicInfo.splice(5, 0, [ + basicInfo.splice(3, 0, [{ title: "BMI", value: "bmi" }]); + basicInfo.splice(4, 0, [{ title: "推荐蛋白范围", value: "recProtein" }]); + basicInfo.splice(5, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]); + basicInfo.splice(6, 0, [ { title: "不运动总热量", value: "notSportHeat" }, ]); - basicInfo.splice(basicInfo.length, 0, [{ title: "备注", value: "remark" }]); + basicInfo.splice(basicInfo.length, 0, [ + { title: "备注", value: "remark" }, + ]); } return { diff --git a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue index bbbea6ca8..b03de5894 100644 --- a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue +++ b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue @@ -312,6 +312,7 @@ export default { ["创建时间", "客户姓名", "手机号"], ["调理项目", "性别", "年龄"], ["身高(厘米)", "体重(斤)", "地域"], + ["BMI", "", ""], ], [ ["减脂经历", "减脂遇到的困难", "减脂是否反弹"], @@ -362,6 +363,7 @@ export default { ["createTime", "name", "phone"], ["conditioningProject", "sex", "age"], ["tall", "weight", "position"], + ["bmi", "", ""], ], [ ["experience", "difficulty", "rebound"], @@ -722,6 +724,12 @@ export default { } return arr; }, []); + detailHealthy.bmi = ( + detailHealthy.weight / + 2 / + (detailHealthy.tall / 100) / + (detailHealthy.tall / 100) + ).toFixed(1); this.detailHealthy = detailHealthy; for (let i = 0; i < this.healthyTitleData.length; i++) { let stepArray = []; diff --git a/stdiet-ui/src/store/modules/recipes.js b/stdiet-ui/src/store/modules/recipes.js index 3448e1f42..c5dc6652a 100644 --- a/stdiet-ui/src/store/modules/recipes.js +++ b/stdiet-ui/src/store/modules/recipes.js @@ -517,6 +517,7 @@ const getters = { obj.fHeat = obj.fWeight * 9; obj.cWeight += (igd.weight / 100) * igd.carbonRatio; obj.cHeat = obj.cWeight * 4; + obj.totalHeat = obj.pHeat + obj.fHeat + obj.cHeat; obj[`heat${cur.type}`] += (igd.weight / 100) * igd.proteinRatio * 4 + (igd.weight / 100) * igd.fatRatio * 9 + @@ -532,16 +533,17 @@ const getters = { pHeat: 0, fHeat: 0, cHeat: 0, + totalHeat: 0, heat1: 0, heat2: 0, heat3: 0, heat4: 0, heat5: 0, - heat6: 0, + heat6: 0 } ) ); - // console.log(nutriData); + console.log(nutriData); return nutriData; }, verifyNotRecData: state => diff --git a/stdiet-ui/src/utils/healthyData.js b/stdiet-ui/src/utils/healthyData.js index 509d7ecbf..a0c1a9816 100644 --- a/stdiet-ui/src/utils/healthyData.js +++ b/stdiet-ui/src/utils/healthyData.js @@ -473,6 +473,12 @@ const moduleObj = { //健康信息处理,将数组转为字符串 export function dealHealthy(customerHealthy) { + customerHealthy.bmi = ( + customerHealthy.weight / + 2 / + (customerHealthy.tall / 100) / + (customerHealthy.tall / 100) + ).toFixed(1); customerHealthy.basicBMR = ( (10 * customerHealthy.weight) / 2 + 6.25 * customerHealthy.tall - diff --git a/stdiet-ui/src/views/custom/ingredient/index.vue b/stdiet-ui/src/views/custom/ingredient/index.vue index 37e214f60..8bac238f2 100644 --- a/stdiet-ui/src/views/custom/ingredient/index.vue +++ b/stdiet-ui/src/views/custom/ingredient/index.vue @@ -352,6 +352,7 @@ :on-success="handleOnUploadSuccess" :on-exceed="handleOnUploadExceed" :on-remove="handleOnUploadRemove" + :on-preview="handleOnUploadPreview" list-type="picture" > @@ -408,6 +409,17 @@ 取 消 + + + +
+ +
+
@@ -437,6 +449,7 @@ export default { return { // 遮罩层 loading: true, + // actionUrl: process.env.VUE_APP_BASE_API + "/custom/fileUpload/ingredient", // 选中数组 @@ -480,6 +493,10 @@ export default { form: {}, // 表单校验 rules: {}, + // + previewVisible: false, + previewUrl: "", + previewTitle: "", }; }, created() { @@ -704,6 +721,23 @@ export default { type: "warning", }); }, + handleOnUploadPreview(file) { + console.log(file); + this.previewTitle = file.name; + this.previewVisible = true; + this.previewUrl = file.url; + }, }, }; + diff --git a/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue b/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue index 1da5ce55c..3e4eda1bc 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue @@ -38,7 +38,7 @@
总热量约等于
- {{ totalHeat.toFixed(1) }}千卡 + {{ data[0] ? data[0].totalHeat.toFixed(1) : 0 }}千卡
@@ -82,7 +82,6 @@ export default { data() { return { chart: null, - totalHeat: 0, nameDict: { p: "蛋白质", f: "脂肪", @@ -107,15 +106,15 @@ export default { mData() { const [data] = this.data; if (!data) { - this.totalHeat = 0; return []; } - this.totalHeat = data.cHeat + data.fHeat + data.pHeat; const mData = ["Weight", "Rate"].map((t, idx) => ({ type: this.typeDict[t], ...["p", "f", "c"].reduce((obj, cur) => { obj[cur] = idx - ? `${((data[`${cur}Heat`] / this.totalHeat) * 100).toFixed(2)}%` + ? data.totalHeat === 0 + ? 0 + : `${((data[`${cur}Heat`] / data.totalHeat) * 100).toFixed(2)}%` : `${data[`${cur}Weight`].toFixed(1)}克`; return obj; }, {}), @@ -199,7 +198,9 @@ export default { top: 18, left: 8, style: { - text: `${this.totalHeat.toFixed(1)}千卡`, + text: `${ + data.totalHeat ? data.totalHeat.toFixed(1) : 0 + }千卡`, font: '14px "Microsoft YaHei", sans-serif', }, },