This commit is contained in:
xiezhijun 2021-03-19 16:02:25 +08:00
commit 636a808d3a
8 changed files with 70 additions and 16 deletions

View File

@ -30,7 +30,6 @@ public class SysFoodHeatStatisticsController extends BaseController
/**
* 查询外食热量统计列表
*/
@PreAuthorize("@ss.hasPermi('custom:foodHeatStatistics:list')")
@GetMapping("/list")
public TableDataInfo list(SysCustomerHeatStatistics sysCustomerHeatStatistics)
{

View File

@ -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, [

View File

@ -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 {

View File

@ -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 = [];

View File

@ -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 =>

View File

@ -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 -

View File

@ -352,6 +352,7 @@
:on-success="handleOnUploadSuccess"
:on-exceed="handleOnUploadExceed"
:on-remove="handleOnUploadRemove"
:on-preview="handleOnUploadPreview"
list-type="picture"
>
<em class="el-icon-upload" />
@ -408,6 +409,17 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 预览弹窗 -->
<el-dialog
:visible.sync="previewVisible"
:title="previewTitle"
class="preview_dialog_wrapper"
>
<div class="preview_content">
<img :src="previewUrl" alt="" class="preview_img" />
</div>
</el-dialog>
</div>
</template>
@ -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;
},
},
};
</script>
<style lang="scss" scoped>
.preview_dialog_wrapper {
.preview_content {
text-align: center;
.preview_img {
max-height: 600px;
width: auto;
}
}
}
</style>

View File

@ -38,7 +38,7 @@
<div class="summary">
<div style="font-size: 12px; color: #606266">总热量约等于</div>
<div style="color: #515a6e; font-weight: bold">
{{ totalHeat.toFixed(1) }}千卡
{{ data[0] ? data[0].totalHeat.toFixed(1) : 0 }}千卡
</div>
</div>
</div>
@ -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',
},
},