!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> <template>
<div> <div class="body_sign_view_wrapper">
<div> <div>
<h2>{{ this.data.name }}</h2> <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"> <div class="msg-info" v-for="(info, idx) in basicInfo" :key="idx">
<text-info <text-info
v-for="con in info" v-for="con in info"
@ -12,20 +20,45 @@
/> />
</div> </div>
</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> </div>
</template> </template>
<script> <script>
import TextInfo from "@/components/TextInfo"; import TextInfo from "@/components/TextInfo";
import { updateHealthy } from "@/api/custom/healthy";
export default { export default {
name: "BodySignView", name: "BodySignView",
props: ["data"], props: {
data: {
type: Object,
default: {},
},
dev: {
type: Boolean,
default: false,
},
},
components: { components: {
"text-info": TextInfo, "text-info": TextInfo,
}, },
data() { data() {
return { const basicInfo = [
basicInfo: [
[ [
{ title: "性别", value: "sex" }, { title: "性别", value: "sex" },
{ title: "年龄", value: "age" }, { title: "年龄", value: "age" },
@ -69,13 +102,47 @@ export default {
[{ title: "病史", value: "signStr" }], [{ title: "病史", value: "signStr" }],
[{ title: "忌口或过敏源", value: "dishesIngredientId" }], [{ title: "忌口或过敏源", value: "dishesIngredientId" }],
[{ title: "方便沟通时间", value: "connectTime" }], [{ title: "方便沟通时间", value: "connectTime" }],
[{ title: "备注", value: "remark" }], ];
], 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> </script>
<style rel="stylesheet/scss" lang="scss"> <style lang="scss" scoped>
.body_sign_view_wrapper {
.remark_btn {
position: absolute;
top: 36px;
right: 16px;
}
.msg-info { .msg-info {
display: flex; display: flex;
margin-bottom: 8px; margin-bottom: 8px;
@ -84,4 +151,5 @@ export default {
margin-bottom: 2px; margin-bottom: 2px;
} }
} }
}
</style> </style>

View File

@ -1,7 +1,15 @@
<template> <template>
<div> <div class="health_view_wrapper">
<div> <div>
<h2>{{ this.data.name }}</h2> <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"> <div class="msg-info" v-for="(info, idx) in basicInfo" :key="idx">
<text-info <text-info
v-for="con in info" v-for="con in info"
@ -28,20 +36,45 @@
</div> </div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </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> </div>
</template> </template>
<script> <script>
import TextInfo from "@/components/TextInfo"; import TextInfo from "@/components/TextInfo";
import { updateHealthy } from "@/api/custom/healthy";
export default { export default {
name: "HealthyView", name: "HealthyView",
props: ["data"], props: {
data: {
type: Object,
default: {},
},
dev: {
type: Boolean,
default: false,
},
},
components: { components: {
"text-info": TextInfo, "text-info": TextInfo,
}, },
data() { data() {
return { const basicInfo = [
basicInfo: [
[ [
{ title: "调理项目", value: "conditioningProject" }, { title: "调理项目", value: "conditioningProject" },
{ title: "电话", value: "phone" }, { title: "电话", value: "phone" },
@ -55,8 +88,18 @@ export default {
{ title: "体重", value: "weight" }, { title: "体重", value: "weight" },
], ],
[{ title: "地域", value: "position" }], [{ title: "地域", value: "position" }],
[{ title: "备注", value: "remark" }], ];
], 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: [ healthyInvestigate: [
{ {
title: "减脂经历评估", title: "减脂经历评估",
@ -180,9 +223,33 @@ 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> </script>
<style rel="stylesheet/scss" lang="scss"> <style lang="scss" scoped>
.health_view_wrapper {
.remark_btn {
position: absolute;
top: 36px;
right: 16px;
}
.msg-info { .msg-info {
display: flex; display: flex;
margin-bottom: 8px; margin-bottom: 8px;
@ -191,4 +258,5 @@ export default {
margin-bottom: 2px; margin-bottom: 2px;
} }
} }
}
</style> </style>

View File

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

View File

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

View File

@ -471,6 +471,16 @@ const moduleObj = {
//健康信息处理,将数组转为字符串 //健康信息处理,将数组转为字符串
export function dealHealthy(customerHealthy) { 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 => { needAttrName.forEach(name => {
if (customerHealthy.hasOwnProperty(name)) { if (customerHealthy.hasOwnProperty(name)) {
customerHealthy[name] = (String(customerHealthy[name]) || "") customerHealthy[name] = (String(customerHealthy[name]) || "")

View File

@ -247,17 +247,10 @@
:summary-method="getSummaries" :summary-method="getSummaries"
style="width: 100%" style="width: 100%"
> >
<el-table-column prop="name" label="食材"></el-table-column> <el-table-column prop="name" label="食材" align="center" />
<el-table-column label="通俗计量"> <el-table-column label="通俗计量" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="cus-unit"> <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-select size="mini" v-model="scope.row.cusWeight">
<el-option <el-option
v-for="dict in cusWeightOptions" v-for="dict in cusWeightOptions"
@ -277,7 +270,7 @@
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="weight" label="重量(g)"> <el-table-column prop="weight" label="重量(g)" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number <el-input-number
class="weight" class="weight"
@ -286,15 +279,36 @@
controls-position="right" controls-position="right"
@change="handleInputChange" @change="handleInputChange"
:min="0" :min="0"
:step="50" :step="5"
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="proteinRatio" label="蛋白质/100g"> <el-table-column
</el-table-column> prop="proteinRatio"
<el-table-column prop="fatRatio" label="脂肪/100g"> label="蛋白质/100g"
</el-table-column> align="center"
<el-table-column prop="carbonRatio" label="碳水/100g"> />
<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-column>
</el-table> </el-table>
</el-form-item> </el-form-item>
@ -740,22 +754,26 @@ export default {
}, },
getSummaries(param) { getSummaries(param) {
const { columns, data } = param; const { columns, data } = param;
console.log(data);
return columns.reduce( return columns.reduce(
(arr, cur, idx) => { (arr, cur, idx) => {
if (idx > 1) { if (idx > 1) {
if (idx === 6) { if (idx === 6) {
// arr[6] = arr[3] * 4 + arr[4] * 9 + arr[5] * 4 + ' kcal';
return arr; } else {
}
arr[idx] = data.reduce((acc, dAcc) => { arr[idx] = data.reduce((acc, dAcc) => {
if (idx === 2) { if (idx === 2) {
return acc + parseFloat(dAcc.weight); return acc + parseFloat(dAcc.weight);
} }
return parseFloat( return parseFloat(
(acc + (dAcc[cur.property] * dAcc.weight) / 100).toFixed(1) (
acc +
(dAcc[cur.property] * parseFloat(dAcc.weight)) / 100
).toFixed(1)
); );
}, 0); }, 0);
} }
}
return arr; return arr;
}, },
["合计"] ["合计"]

View File

@ -97,12 +97,10 @@
size="mini" size="mini"
@click="handleQuery" @click="handleQuery"
>搜索 >搜索
</el-button </el-button>
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置 >重置
</el-button </el-button>
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -179,6 +177,17 @@
align="center" align="center"
prop="carbonRatio" 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 <el-table-column
label="地域" label="地域"
align="center" align="center"
@ -591,8 +600,7 @@
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}) })
.catch(function () { .catch(function () {});
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -608,12 +616,11 @@
.then((response) => { .then((response) => {
this.download(response.msg); this.download(response.msg);
}) })
.catch(function () { .catch(function () {});
});
}, },
string2Arr(str) { string2Arr(str) {
return str ? str.split(',') : [] return str ? str.split(",") : [];
} },
}, },
}; };
</script> </script>

View File

@ -30,6 +30,10 @@ export default {
type: Array, type: Array,
default: [], default: [],
}, },
max: {
type: Number,
default: 0,
},
}, },
data() { data() {
return { return {
@ -64,6 +68,7 @@ export default {
this.updateChart(this.data.length > 0 ? this.data : {}); this.updateChart(this.data.length > 0 ? this.data : {});
}, },
updateChart(source) { updateChart(source) {
console.log(this.max);
this.chart.clear(); this.chart.clear();
this.chart.setOption({ this.chart.setOption({
title: { title: {
@ -112,7 +117,7 @@ export default {
grid: { grid: {
top: 55, top: 55,
left: 20, left: 20,
right: 20, right: 50,
bottom: 10, bottom: 10,
containLabel: true, containLabel: true,
}, },
@ -135,6 +140,13 @@ export default {
y: dim, y: dim,
x: 0, x: 0,
}, },
markLine: {
data: [{ name: "BMR", yAxis: this.max - 400 }],
symbol: "none",
lineStyle: {
color: "red",
},
},
itemStyle: { itemStyle: {
borderWidth: 2, borderWidth: 2,
borderColor: "#fff", borderColor: "#fff",

View File

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

View File

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