!88 添加备注,柱状图标线

Merge pull request !88 from 德仔/develop
This commit is contained in:
德仔 2021-03-03 19:26:17 +08:00 committed by Gitee
commit 4880a16faa
10 changed files with 550 additions and 357 deletions

View File

@ -1,7 +1,15 @@
<template>
<div>
<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
> -->
<div class="msg-info" v-for="(info, idx) in basicInfo" :key="idx">
<text-info
v-for="con in info"
@ -12,76 +20,136 @@
/>
</div>
</div>
<!-- 备注弹窗 -->
<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";
export default {
name: "BodySignView",
props: ["data"],
props: {
data: {
type: Object,
default: {},
},
dev: {
type: Boolean,
default: false,
},
},
components: {
"text-info": TextInfo,
},
data() {
return {
basicInfo: [
[
{ title: "性别", value: "sex" },
{ title: "年龄", value: "age" },
],
[
{ title: "电话", value: "phone" },
{ title: "地域", value: "position" },
],
[
{ title: "身高", value: "tall" },
{ title: "体重", value: "weight" },
],
[
{ title: "工作职业", value: "vocation" },
{ title: "上夜班", value: "night" },
],
[
{ title: "熬夜失眠", value: "staylate" },
{ title: "运动情况", value: "walk" },
],
[
{ title: "浑身乏力", value: "weakness" },
{ title: "经常运动", value: "motion" },
],
[
{ title: "睡觉时间", value: "sleepTime" },
{ title: "起床时间", value: "getupTime" },
],
[
{ title: "饮食方式", value: "makeFoodType" },
{ title: "饮食特点", value: "makeFoodTaste" },
],
[{ title: "便秘", value: "constipation" }],
[{ title: "饮食备注", value: "remarks" }],
[{ title: "减脂反弹", value: "rebound" }],
[{ title: "意识到生活习惯是减脂关键", value: "crux" }],
[{ title: "减脂遇到的困难", value: "difficulty" }],
[{ title: "湿气数据", value: "moistureDate" }],
[{ title: "气血数据", value: "bloodData" }],
[{ title: "病史", value: "signStr" }],
[{ title: "忌口或过敏源", value: "dishesIngredientId" }],
[{ title: "方便沟通时间", value: "connectTime" }],
[{ title: "备注", value: "remark" }],
const basicInfo = [
[
{ title: "性别", value: "sex" },
{ title: "年龄", value: "age" },
],
[
{ title: "电话", value: "phone" },
{ title: "地域", value: "position" },
],
[
{ title: "身高", value: "tall" },
{ title: "体重", value: "weight" },
],
[
{ title: "工作职业", value: "vocation" },
{ title: "上夜班", value: "night" },
],
[
{ title: "熬夜失眠", value: "staylate" },
{ title: "运动情况", value: "walk" },
],
[
{ title: "浑身乏力", value: "weakness" },
{ title: "经常运动", value: "motion" },
],
[
{ title: "睡觉时间", value: "sleepTime" },
{ title: "起床时间", value: "getupTime" },
],
[
{ title: "饮食方式", value: "makeFoodType" },
{ title: "饮食特点", value: "makeFoodTaste" },
],
[{ title: "便秘", value: "constipation" }],
[{ title: "饮食备注", value: "remarks" }],
[{ title: "减脂反弹", value: "rebound" }],
[{ title: "意识到生活习惯是减脂关键", value: "crux" }],
[{ title: "减脂遇到的困难", value: "difficulty" }],
[{ title: "湿气数据", value: "moistureDate" }],
[{ title: "气血数据", value: "bloodData" }],
[{ title: "病史", value: "signStr" }],
[{ title: "忌口或过敏源", value: "dishesIngredientId" }],
[{ title: "方便沟通时间", value: "connectTime" }],
];
if (this.dev) {
basicInfo.splice(3, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]);
basicInfo.splice(4, 0, [
{ title: "不运动总热量", value: "notSportHeat" },
]);
basicInfo.splice(basicInfo.length, 0, [
{ title: "备注", value: "remark" },
]);
}
return {
basicInfo,
open: false,
};
},
methods: {
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>
<style rel="stylesheet/scss" lang="scss">
.msg-info {
display: flex;
margin-bottom: 8px;
<style lang="scss" scoped>
.body_sign_view_wrapper {
.remark_btn {
position: absolute;
top: 36px;
right: 16px;
}
.msg-info {
display: flex;
margin-bottom: 8px;
.text-info-extra {
margin-bottom: 2px;
.text-info-extra {
margin-bottom: 2px;
}
}
}
</style>

View File

@ -1,7 +1,15 @@
<template>
<div>
<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="con in info"
@ -28,35 +36,70 @@
</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";
export default {
name: "HealthyView",
props: ["data"],
props: {
data: {
type: Object,
default: {},
},
dev: {
type: Boolean,
default: false,
},
},
components: {
"text-info": TextInfo,
},
data() {
return {
basicInfo: [
[
{ title: "调理项目", value: "conditioningProject" },
{ title: "电话", value: "phone" },
],
[
{ title: "性别", value: "sex" },
{ title: "年龄", value: "age" },
],
[
{ title: "身高", value: "tall" },
{ title: "体重", value: "weight" },
],
[{ title: "地域", value: "position" }],
[{ title: "备注", value: "remark" }],
const basicInfo = [
[
{ title: "调理项目", value: "conditioningProject" },
{ title: "电话", value: "phone" },
],
[
{ title: "性别", value: "sex" },
{ title: "年龄", value: "age" },
],
[
{ title: "身高", value: "tall" },
{ title: "体重", value: "weight" },
],
[{ title: "地域", value: "position" }],
];
if (this.dev) {
basicInfo.splice(3, 0, [{ title: "基础代谢BMR", value: "basicBMR" }]);
basicInfo.splice(4, 0, [
{ title: "不运动总热量", value: "notSportHeat" },
]);
basicInfo.splice(6, 0, [{ title: "备注", value: "remark" }]);
}
return {
open: false,
basicInfo,
healthyInvestigate: [
{
title: "减脂经历评估",
@ -180,15 +223,40 @@ export default {
],
};
},
methods: {
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>
<style rel="stylesheet/scss" lang="scss">
.msg-info {
display: flex;
margin-bottom: 8px;
<style lang="scss" scoped>
.health_view_wrapper {
.remark_btn {
position: absolute;
top: 36px;
right: 16px;
}
.text-info-extra {
margin-bottom: 2px;
.msg-info {
display: flex;
margin-bottom: 8px;
.text-info-extra {
margin-bottom: 2px;
}
}
}
</style>

View File

@ -4,7 +4,7 @@
<el-form-item label="" prop="remark" >
<el-input
type="textarea"
:rows="5"
:rows="6"
maxlength="300"
show-word-limit
placeholder="请输入备注"

View File

@ -14,7 +14,7 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['orderPause:pause:add']"
v-hasPermi="['recipes:pause:add']"
>新增</el-button
>
</el-col>
@ -24,7 +24,7 @@
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['orderPause:pause:export']"
v-hasPermi="['recipes:pause:export']"
>导出</el-button
>
</el-col>
@ -96,7 +96,7 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['orderPause:pause:edit']"
v-hasPermi="['recipes:pause:edit']"
>修改</el-button
>
<el-button
@ -104,7 +104,7 @@
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['orderPause:pause:remove']"
v-hasPermi="['recipes:pause:remove']"
>删除</el-button
>
</template>

View File

@ -471,6 +471,16 @@ const moduleObj = {
//健康信息处理,将数组转为字符串
export function dealHealthy(customerHealthy) {
customerHealthy.basicBMR = (
(10 * customerHealthy.weight) / 2 +
6.25 * customerHealthy.tall -
5 * customerHealthy.age -
customerHealthy.sex * 161
).toFixed(1);
customerHealthy.notSportHeat = (customerHealthy.basicBMR * 1.3).toFixed(1);
customerHealthy.basicBMR += "千卡";
customerHealthy.notSportHeat += "千卡";
needAttrName.forEach(name => {
if (customerHealthy.hasOwnProperty(name)) {
customerHealthy[name] = (String(customerHealthy[name]) || "")

View File

@ -247,17 +247,10 @@
:summary-method="getSummaries"
style="width: 100%"
>
<el-table-column prop="name" label="食材"></el-table-column>
<el-table-column label="通俗计量">
<el-table-column prop="name" label="食材" align="center" />
<el-table-column label="通俗计量" align="center">
<template slot-scope="scope">
<span class="cus-unit">
<!-- <el-input-number
v-model="scope.row.cusWeight"
size="mini"
controls-position="right"
step="0.5"
:min="0.5"
/> -->
<el-select size="mini" v-model="scope.row.cusWeight">
<el-option
v-for="dict in cusWeightOptions"
@ -277,7 +270,7 @@
</span>
</template>
</el-table-column>
<el-table-column prop="weight" label="重量(g)">
<el-table-column prop="weight" label="重量(g)" align="center">
<template slot-scope="scope">
<el-input-number
class="weight"
@ -286,15 +279,36 @@
controls-position="right"
@change="handleInputChange"
:min="0"
:step="50"
:step="5"
/>
</template>
</el-table-column>
<el-table-column prop="proteinRatio" label="蛋白质/100g">
</el-table-column>
<el-table-column prop="fatRatio" label="脂肪/100g">
</el-table-column>
<el-table-column prop="carbonRatio" label="碳水/100g">
<el-table-column
prop="proteinRatio"
label="蛋白质/100g"
align="center"
/>
<el-table-column
prop="fatRatio"
label="脂肪/100g"
align="center"
/>
<el-table-column
prop="carbonRatio"
label="碳水/100g"
align="center"
/>
<el-table-column label="热量" align="center">
<template slot-scope="scope">
{{
`${(
((scope.row.proteinRatio * scope.row.weight) / 100) *
4 +
((scope.row.fatRatio * scope.row.weight) / 100) * 9 +
((scope.row.carbonRatio * scope.row.weight) / 100) * 4
).toFixed(1)} kcal`
}}
</template>
</el-table-column>
</el-table>
</el-form-item>
@ -740,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;
},

View File

@ -96,13 +96,11 @@
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索
</el-button
>
>搜索
</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置
</el-button
>
>重置
</el-button>
</el-form-item>
</el-form>
@ -114,7 +112,7 @@
size="mini"
@click="handleAdd"
v-hasPermi="['custom:ingredient:add']"
>新增
>新增
</el-button>
</el-col>
<el-col :span="1.5">
@ -124,7 +122,7 @@
size="mini"
@click="handleExport"
v-hasPermi="['custom:ingredient:export']"
>导出
>导出
</el-button>
</el-col>
<right-toolbar
@ -179,6 +177,17 @@
align="center"
prop="carbonRatio"
/>
<el-table-column label="每百克热量(千卡)" align="center" width="120">
<template slot-scope="scope">
{{
(
scope.row.proteinRatio * 4 +
scope.row.fatRatio * 9 +
scope.row.carbonRatio * 4
).toFixed(1)
}}
</template>
</el-table-column>
<el-table-column
label="地域"
align="center"
@ -192,15 +201,15 @@
width="120"
>
<template slot-scope="scope">
<autohideinfo :data="string2Arr(scope.row.notRec)"/>
<autohideinfo :data="string2Arr(scope.row.notRec)" />
</template>
</el-table-column>
<el-table-column label="推荐人群" align="center" prop="rec" width="120">
<template slot-scope="scope">
<autohideinfo :data="string2Arr(scope.row.rec)"/>
<autohideinfo :data="string2Arr(scope.row.rec)" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column
label="操作"
align="center"
@ -213,7 +222,7 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:ingredient:edit']"
>修改
>修改
</el-button>
<el-button
size="mini"
@ -221,7 +230,7 @@
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:ingredient:remove']"
>删除
>删除
</el-button>
</template>
</el-table-column>
@ -241,7 +250,7 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-col :span="12">
<el-form-item label="食材名称" prop="name" label-width="90px">
<el-input v-model="form.name" placeholder="请输入食材名称"/>
<el-input v-model="form.name" placeholder="请输入食材名称" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -376,244 +385,242 @@
</template>
<script>
import {
addIngredient,
delIngredient,
exportIngredient,
getIngredient,
listIngredient,
updateIngredient,
} from "@/api/custom/ingredient";
import {
addIngredient,
delIngredient,
exportIngredient,
getIngredient,
listIngredient,
updateIngredient,
} from "@/api/custom/ingredient";
import AutoHideInfo from "@/components/AutoHideInfo";
import AutoHideInfo from "@/components/AutoHideInfo";
import {listPhysicalSigns} from "@/api/custom/physicalSigns";
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
export default {
name: "Ingredient",
components: {
autohideinfo: AutoHideInfo,
export default {
name: "Ingredient",
components: {
autohideinfo: AutoHideInfo,
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
ingredientList: [],
//
reviewStatusOptions: [],
//
title: "",
//
open: false,
//
typeOptions: [],
//
areaOptions: [],
//
physicalSignsOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
area: null,
notRecIds: null,
recIds: null,
reviewStatus: null,
},
//
form: {},
//
rules: {},
};
},
created() {
this.getList();
this.getDicts("cus_ing_type").then((response) => {
this.typeOptions = response.data;
});
this.getDicts("cus_area").then((response) => {
this.areaOptions = response.data;
});
this.getDicts("cus_review_status").then((response) => {
this.reviewStatusOptions = response.data;
});
listPhysicalSigns().then((response) => {
this.physicalSignsOptions = response.rows.map((obj) => ({
dictLabel: obj.name,
dictValue: obj.id,
}));
});
},
methods: {
/** 查询食材列表 */
getList() {
this.loading = true;
listIngredient(this.queryParams).then((response) => {
this.ingredientList = response.rows;
this.total = response.total;
this.loading = false;
});
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
ingredientList: [],
//
reviewStatusOptions: [],
//
title: "",
//
open: false,
//
typeOptions: [],
//
areaOptions: [],
//
physicalSignsOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
area: null,
notRecIds: null,
recIds: null,
reviewStatus: null,
},
//
form: {},
//
rules: {},
//
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.type);
},
//
areaFormat(row, column) {
return this.selectDictLabel(this.areaOptions, row.area);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
type: null,
proteinRatio: null,
fatRatio: null,
carbonRatio: null,
area: null,
notRecIds: [],
recIds: [],
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
};
this.resetForm("form");
},
created() {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.getDicts("cus_ing_type").then((response) => {
this.typeOptions = response.data;
});
this.getDicts("cus_area").then((response) => {
this.areaOptions = response.data;
});
this.getDicts("cus_review_status").then((response) => {
this.reviewStatusOptions = response.data;
});
listPhysicalSigns().then((response) => {
this.physicalSignsOptions = response.rows.map((obj) => ({
dictLabel: obj.name,
dictValue: obj.id,
}));
});
},
methods: {
/** 查询食材列表 */
getList() {
this.loading = true;
listIngredient(this.queryParams).then((response) => {
this.ingredientList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.type);
},
//
areaFormat(row, column) {
return this.selectDictLabel(this.areaOptions, row.area);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
type: null,
proteinRatio: null,
fatRatio: null,
carbonRatio: null,
area: null,
notRecIds: [],
recIds: [],
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加食材";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getIngredient(id).then((response) => {
this.form = response.data;
this.form.notRecIds = this.form.notRec
? this.form.notRec
.split(",")
.map(
(label) =>
this.physicalSignsOptions.find(
(pObj) => pObj.dictLabel === label
).dictValue
)
: [];
this.form.recIds = this.form.rec
? this.form.rec
.split(",")
.map(
(label) =>
this.physicalSignsOptions.find(
(pObj) => pObj.dictLabel === label
).dictValue
)
: [];
this.open = true;
this.title = "添加食材";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getIngredient(id).then((response) => {
this.form = response.data;
this.form.notRecIds = this.form.notRec
? this.form.notRec
.split(",")
.map(
(label) =>
this.physicalSignsOptions.find(
(pObj) => pObj.dictLabel === label
).dictValue
)
: [];
this.form.recIds = this.form.rec
? this.form.rec
.split(",")
.map(
(label) =>
this.physicalSignsOptions.find(
(pObj) => pObj.dictLabel === label
).dictValue
)
: [];
this.open = true;
this.title = "修改食材";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateIngredient(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addIngredient(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除食材编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delIngredient(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有食材数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportIngredient(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {
});
},
string2Arr(str) {
return str ? str.split(',') : []
}
this.title = "修改食材";
});
},
};
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateIngredient(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addIngredient(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除食材编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delIngredient(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有食材数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportIngredient(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {});
},
string2Arr(str) {
return str ? str.split(",") : [];
},
},
};
</script>

View File

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

View File

@ -58,6 +58,16 @@
:data="data"
height="170px"
width="500px"
:max="
healthyData.basicBMR
? parseFloat(
healthyData.basicBMR.substring(
0,
healthyData.basicBMR.indexOf('千卡')
)
)
: 0
"
/>
<PieChart
v-if="data.length === 1"
@ -89,7 +99,7 @@ export default {
},
props: ["collapse", "data"],
computed: {
...mapState(["recipesId", "reviewStatus"]),
...mapState(["recipesId", "reviewStatus", "healthyData"]),
},
methods: {
handleCollapseClick() {

View File

@ -11,8 +11,8 @@
</div>
<div class="right" v-loading="healthDataLoading">
<TemplateInfoView v-if="!!temId" :data="templateInfo" />
<HealthyView :data="healthyData" v-else-if="healthyDataType === 0" />
<BodySignView :data="healthyData" v-else />
<HealthyView :data="healthyData" v-else-if="healthyDataType === 0" dev />
<BodySignView :data="healthyData" v-else dev />
</div>
</div>
</template>