From 96a405a314bb297cc7323735c434e86df253224d Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Wed, 3 Mar 2021 19:25:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=87=E6=B3=A8=EF=BC=8C?= =?UTF-8?q?=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=A0=87=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/BodySignView/index.vue | 176 ++++++++++++------ .../src/components/HealthyView/index.vue | 116 +++++++++--- .../components/PhysicalSignsRemark/index.vue | 2 +- stdiet-ui/src/utils/healthyData.js | 10 + stdiet-ui/src/views/custom/dishes/index.vue | 35 ++-- .../RecipesView/RecipesAspectCom/BarChart.vue | 14 +- .../RecipesView/RecipesAspectCom/index.vue | 12 +- .../src/views/custom/recipesBuild/index.vue | 4 +- 8 files changed, 271 insertions(+), 98 deletions(-) diff --git a/stdiet-ui/src/components/BodySignView/index.vue b/stdiet-ui/src/components/BodySignView/index.vue index 89b1f13bf..417dc8b4c 100644 --- a/stdiet-ui/src/components/BodySignView/index.vue +++ b/stdiet-ui/src/components/BodySignView/index.vue @@ -1,7 +1,15 @@ - diff --git a/stdiet-ui/src/components/HealthyView/index.vue b/stdiet-ui/src/components/HealthyView/index.vue index a6b0135ac..ee00f0956 100644 --- a/stdiet-ui/src/components/HealthyView/index.vue +++ b/stdiet-ui/src/components/HealthyView/index.vue @@ -1,7 +1,15 @@ - diff --git a/stdiet-ui/src/components/PhysicalSignsRemark/index.vue b/stdiet-ui/src/components/PhysicalSignsRemark/index.vue index 8c3d57b71..a2d43b832 100644 --- a/stdiet-ui/src/components/PhysicalSignsRemark/index.vue +++ b/stdiet-ui/src/components/PhysicalSignsRemark/index.vue @@ -4,7 +4,7 @@ { if (customerHealthy.hasOwnProperty(name)) { customerHealthy[name] = (String(customerHealthy[name]) || "") diff --git a/stdiet-ui/src/views/custom/dishes/index.vue b/stdiet-ui/src/views/custom/dishes/index.vue index d64acc459..8f0bb00d1 100644 --- a/stdiet-ui/src/views/custom/dishes/index.vue +++ b/stdiet-ui/src/views/custom/dishes/index.vue @@ -279,7 +279,7 @@ controls-position="right" @change="handleInputChange" :min="0" - :step="50" + :step="5" /> @@ -298,13 +298,14 @@ label="碳水/100g" align="center" /> - + @@ -753,21 +754,25 @@ export default { }, getSummaries(param) { const { columns, data } = param; + console.log(data); return columns.reduce( (arr, cur, idx) => { if (idx > 1) { if (idx === 6) { - // 备注 - return arr; + arr[6] = arr[3] * 4 + arr[4] * 9 + arr[5] * 4 + ' kcal'; + } else { + arr[idx] = data.reduce((acc, dAcc) => { + if (idx === 2) { + return acc + parseFloat(dAcc.weight); + } + return parseFloat( + ( + acc + + (dAcc[cur.property] * parseFloat(dAcc.weight)) / 100 + ).toFixed(1) + ); + }, 0); } - arr[idx] = data.reduce((acc, dAcc) => { - if (idx === 2) { - return acc + parseFloat(dAcc.weight); - } - return parseFloat( - (acc + (dAcc[cur.property] * dAcc.weight) / 100).toFixed(1) - ); - }, 0); } return arr; }, diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/BarChart.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/BarChart.vue index 91fd440ad..531961636 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/BarChart.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/BarChart.vue @@ -30,6 +30,10 @@ export default { type: Array, default: [], }, + max: { + type: Number, + default: 0, + }, }, data() { return { @@ -64,6 +68,7 @@ export default { this.updateChart(this.data.length > 0 ? this.data : {}); }, updateChart(source) { + console.log(this.max); this.chart.clear(); this.chart.setOption({ title: { @@ -112,7 +117,7 @@ export default { grid: { top: 55, left: 20, - right: 20, + right: 50, bottom: 10, containLabel: true, }, @@ -135,6 +140,13 @@ export default { y: dim, x: 0, }, + markLine: { + data: [{ name: "BMR", yAxis: this.max - 400 }], + symbol: "none", + lineStyle: { + color: "red", + }, + }, itemStyle: { borderWidth: 2, borderColor: "#fff", diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/index.vue index 9c7705d47..65b73303b 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/index.vue @@ -58,6 +58,16 @@ :data="data" height="170px" width="500px" + :max=" + healthyData.basicBMR + ? parseFloat( + healthyData.basicBMR.substring( + 0, + healthyData.basicBMR.indexOf('千卡') + ) + ) + : 0 + " />
- - + +