Merge branches 'master' and 'xzj' of https://gitee.com/darlk/ShengTangManage into xzj
# Conflicts: # stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/index.vue
This commit is contained in:
@ -138,9 +138,11 @@ export default {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.body_sign_view_wrapper {
|
||||
position: relative;
|
||||
|
||||
.remark_btn {
|
||||
position: absolute;
|
||||
top: 36px;
|
||||
top: 0;
|
||||
right: 16px;
|
||||
}
|
||||
.msg-info {
|
||||
|
@ -244,9 +244,10 @@ export default {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.health_view_wrapper {
|
||||
position: relative;
|
||||
.remark_btn {
|
||||
position: absolute;
|
||||
top: 36px;
|
||||
top: 0;
|
||||
right: 16px;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ const mutations = {
|
||||
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
|
||||
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
|
||||
}
|
||||
console.log(JSON.parse(JSON.stringify(state.recipesData)));
|
||||
} else if (actionType === "delIgd") {
|
||||
tarDishes.igdList = tarDishes.igdList.filter(
|
||||
igd => igd.id !== payload.igdId
|
||||
|
@ -76,7 +76,7 @@ export default {
|
||||
},
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
appendToBody: true,
|
||||
// appendToBody: true,
|
||||
formatter: (params) => {
|
||||
// console.log(params);
|
||||
const [param] = params;
|
||||
@ -115,26 +115,30 @@ export default {
|
||||
source,
|
||||
},
|
||||
grid: {
|
||||
top: 55,
|
||||
left: 20,
|
||||
top: 50,
|
||||
left: 10,
|
||||
right: 50,
|
||||
bottom: 10,
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: {
|
||||
type: "category",
|
||||
// axisLabel: {
|
||||
// rotate: 45,
|
||||
// },
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
name: "热量(千卡)",
|
||||
name: "热量/千卡",
|
||||
nameTextStyle: {
|
||||
color: "#262626",
|
||||
fontSize: 12,
|
||||
},
|
||||
},
|
||||
series: ["pHeat", "fHeat", "cHeat"].map((dim, idx) => ({
|
||||
name: dim,
|
||||
type: "bar",
|
||||
barWidth: 26,
|
||||
barWidth: 24,
|
||||
stack: "bar",
|
||||
encode: {
|
||||
y: dim,
|
@ -3,7 +3,7 @@
|
||||
:class="`aspect_pie_chart_wrapper ${className || ''}`"
|
||||
:style="{ height: height, width: width }"
|
||||
>
|
||||
<div ref="echart" :style="{ height: height, width: '200px' }" />
|
||||
<div ref="echart" :style="{ height: height, width: '100px' }" />
|
||||
<div>
|
||||
<el-table
|
||||
:data="mData"
|
||||
@ -14,13 +14,20 @@
|
||||
class="small_table"
|
||||
>
|
||||
<el-table-column label="营养" prop="type" align="center" width="60" />
|
||||
<el-table-column label="蛋白质" prop="p" align="center" width="80" />
|
||||
<el-table-column label="脂肪" prop="f" align="center" width="80" />
|
||||
<el-table-column label="碳水" prop="c" align="center" width="80" />
|
||||
<el-table-column label="蛋白质" prop="p" align="center" width="65" />
|
||||
<el-table-column label="脂肪" prop="f" align="center" width="65" />
|
||||
<el-table-column label="碳水" prop="c" align="center" width="65" />
|
||||
</el-table>
|
||||
<div class="summary">
|
||||
<div style="font-size: 12px; color: #606266;">总热量约等于</div>
|
||||
<div style="color: #515a6e; font-weight: bold">{{ totalHeat.toFixed(1) }}千卡</div>
|
||||
<div style="font-size: 12px; color: #606266">总热量约等于</div>
|
||||
<div style="color: #515a6e; font-weight: bold">
|
||||
{{ totalHeat.toFixed(1) }}千卡
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: right; margin-top: 4px">
|
||||
<el-button size="mini" type="text" @click="backToAll"
|
||||
>查看全部</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -31,6 +38,8 @@ import echarts from "echarts";
|
||||
require("@/utils/echarts/myShine");
|
||||
import resize from "@/views/dashboard/mixins/resize";
|
||||
import TextInfo from "@/components/TextInfo";
|
||||
import { createNamespacedHelpers } from "vuex";
|
||||
const { mapMutations } = createNamespacedHelpers("recipes");
|
||||
|
||||
export default {
|
||||
mixins: [resize],
|
||||
@ -108,16 +117,20 @@ export default {
|
||||
this.chart = echarts.init(this.$refs.echart, "myShine");
|
||||
this.updateChart(this.data.length > 0 ? this.data[0] : {});
|
||||
},
|
||||
backToAll() {
|
||||
this.resetCurrentDay({ currentDay: -1 });
|
||||
},
|
||||
updateChart(data) {
|
||||
this.chart.clear();
|
||||
this.chart.setOption({
|
||||
title: {
|
||||
text: `${data.name}营养分析`,
|
||||
text: "营养分析",
|
||||
subtext: data.name,
|
||||
},
|
||||
tooltip: {
|
||||
position: "right",
|
||||
trigger: "item",
|
||||
appendToBody: true,
|
||||
// appendToBody: true,
|
||||
formatter: (params) => {
|
||||
const {
|
||||
name,
|
||||
@ -137,23 +150,25 @@ export default {
|
||||
{
|
||||
name: data.name,
|
||||
type: "pie",
|
||||
radius: [0, 50],
|
||||
center: ["50%", "50%"],
|
||||
radius: [0, 40],
|
||||
center: ["50%", "55%"],
|
||||
data: ["p", "f", "c"].map((dim) => ({
|
||||
dim,
|
||||
value: data[`${dim}Heat`],
|
||||
name: this.nameDict[dim],
|
||||
oriData: data,
|
||||
})),
|
||||
labelLine: {
|
||||
length: 5,
|
||||
length2: 5,
|
||||
},
|
||||
// label: {
|
||||
// show: true,
|
||||
// position: "inside",
|
||||
// color: '#fff'
|
||||
// labelLine: {
|
||||
// length: 5,
|
||||
// length2: 5,
|
||||
// },
|
||||
label: {
|
||||
show: true,
|
||||
position: "inside",
|
||||
color: "#fff",
|
||||
fontSize: 10,
|
||||
fontWeight: "bold",
|
||||
},
|
||||
itemStyle: {
|
||||
borderWidth: 1,
|
||||
borderColor: "#fff",
|
||||
@ -162,6 +177,7 @@ export default {
|
||||
],
|
||||
});
|
||||
},
|
||||
...mapMutations(["resetCurrentDay"]),
|
||||
},
|
||||
watch: {
|
||||
data(newVal, oldVal) {
|
@ -9,7 +9,7 @@
|
||||
:step="5"
|
||||
:value="value"
|
||||
@blur="handleOnBlur"
|
||||
@keyup.enter="handleEnterClick"
|
||||
@keydown.enter="handleEnterClick"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -14,7 +14,9 @@
|
||||
:key="item.dictValue"
|
||||
:value="item.dictValue"
|
||||
>
|
||||
{{ item.dictLabel }}
|
||||
<div style="width: 120px">
|
||||
{{ item.dictLabel }}
|
||||
</div>
|
||||
</option>
|
||||
</select>
|
||||
<select
|
||||
@ -150,6 +152,10 @@ export default {
|
||||
select::-ms-expand {
|
||||
display: none;
|
||||
}
|
||||
|
||||
option {
|
||||
width: 140px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -11,7 +11,7 @@
|
||||
:cell-class-name="cellClassName"
|
||||
:style="`outline: ${currentDay === num ? '1px solid #d53950' : 'none'}`"
|
||||
>
|
||||
<el-table-column prop="type" :width="100" align="center">
|
||||
<el-table-column prop="type" :width="80" align="center">
|
||||
<template slot="header">
|
||||
<div class="pointer_style" @click="handleOnResetCurrentDay">
|
||||
{{ `第${numDay}天` }}
|
||||
@ -477,7 +477,7 @@ export default {
|
||||
// console.log(this.copyData);
|
||||
if (this.copyData) {
|
||||
const data = {
|
||||
...this.copyData,
|
||||
...JSON.parse(JSON.stringify(this.copyData)),
|
||||
type,
|
||||
};
|
||||
if (!this.recipesId) {
|
||||
@ -619,6 +619,10 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.el-table .cell {
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.recipes_header {
|
||||
& > th {
|
||||
background: #d53950 !important;
|
||||
|
@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<div class="recipes_header_com_wrapper">
|
||||
<div class="header_btns" v-loading="loading">
|
||||
<section>
|
||||
<el-button
|
||||
size="mini"
|
||||
v-if="!!recipesId"
|
||||
type="primary"
|
||||
icon="el-icon-document-copy"
|
||||
@click="handleOnTemplateClick"
|
||||
>
|
||||
另存为模板
|
||||
</el-button>
|
||||
</section>
|
||||
<section>
|
||||
<span class="font_size_style">
|
||||
字体大小:
|
||||
<el-select
|
||||
v-model="fontSize"
|
||||
size="mini"
|
||||
style="width: 80px"
|
||||
@change="handleOnSizeChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="size in fontSizeOpts"
|
||||
:key="size.value"
|
||||
:label="size.label"
|
||||
:value="size.value"
|
||||
/>
|
||||
</el-select>
|
||||
</span>
|
||||
<el-button size="mini" v-if="!recipesId" @click="handleOnBack"
|
||||
>返回</el-button
|
||||
>
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
trigger="click"
|
||||
title="修改审核状态"
|
||||
style="margin-right: 12px"
|
||||
v-hasPermi="['recipes:plan:review']"
|
||||
>
|
||||
<div>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="success"
|
||||
@click="hanldeOnReveiwChange(2)"
|
||||
>审核通过</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="danger"
|
||||
@click="hanldeOnReveiwChange(1)"
|
||||
>未审核通过</el-button
|
||||
>
|
||||
</div>
|
||||
<el-button
|
||||
slot="reference"
|
||||
size="mini"
|
||||
v-if="reviewStatus"
|
||||
:type="reviewStatus === 1 ? 'danger' : 'success'"
|
||||
>
|
||||
{{ reviewStatus === 1 ? "未审核" : "已审核" }}
|
||||
</el-button>
|
||||
</el-popover>
|
||||
<el-button
|
||||
v-if="!recipesId"
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="handleOnSave"
|
||||
>生成食谱</el-button
|
||||
>
|
||||
</section>
|
||||
</div>
|
||||
<!-- 模板 -->
|
||||
<TemplateDialog ref="templateRef" @onConfirm="handleOnCopy" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { addRecipesTemplate } from "@/api/custom/recipesTemplate";
|
||||
import { createNamespacedHelpers } from "vuex";
|
||||
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
|
||||
"recipes"
|
||||
);
|
||||
import TemplateDialog from "@/components/TemplateDialog";
|
||||
export default {
|
||||
name: "RecipesHeaderCom",
|
||||
components: {
|
||||
// BarChart,
|
||||
// PieChart,
|
||||
TemplateDialog,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
nFontSize: 0,
|
||||
fontSizeOpts: [
|
||||
{ value: 8, label: "8" },
|
||||
{ value: 10, label: "10" },
|
||||
{ value: 12, label: "12" },
|
||||
{ value: 14, label: "14" },
|
||||
{ value: 16, label: "16" },
|
||||
{ value: 18, label: "18" },
|
||||
],
|
||||
};
|
||||
},
|
||||
updated() {
|
||||
},
|
||||
computed: {
|
||||
...mapState(["recipesId", "reviewStatus", "fontSize"]),
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
methods: {
|
||||
handleOnSizeChange(fontSize) {
|
||||
this.updateFontSize({ fontSize });
|
||||
},
|
||||
handleOnSave() {
|
||||
this.saveRecipes({
|
||||
callback: (query) => {
|
||||
// console.log(query);
|
||||
this.$router.replace({
|
||||
path: "/recipes/build/" + query.name + "/" + query.planId,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
hanldeOnReveiwChange(reviewStatus) {
|
||||
this.updateReviewStatus({ reviewStatus });
|
||||
},
|
||||
handleOnBack() {
|
||||
this.updateStateData({ recipesData: [] });
|
||||
},
|
||||
handleOnTemplateClick() {
|
||||
this.$refs.templateRef.showDialog();
|
||||
},
|
||||
handleOnCopy(form) {
|
||||
this.loading = true;
|
||||
addRecipesTemplate(form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
const { planId, id } = response.data;
|
||||
this.saveRecipes({
|
||||
cusId: 0,
|
||||
planId,
|
||||
callback: () => {
|
||||
this.$message.success(`另存为模板「${form.name}」成功`);
|
||||
this.loading = false;
|
||||
// window.open(
|
||||
// "/recipes/build/" + form.name + "/" + planId + "?temId=" + id,
|
||||
// "_blank"
|
||||
// );
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
...mapActions(["saveRecipes", "updateReviewStatus"]),
|
||||
...mapMutations(["updateStateData", "updateFontSize"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scope>
|
||||
.recipes_header_com_wrapper {
|
||||
.header_btns {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.font_size_style {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,11 +1,7 @@
|
||||
<template>
|
||||
<div class="recipes_view_wrapper">
|
||||
<RecipesAspectCom :collapse.sync="collapse" :data="analyseData" />
|
||||
<div
|
||||
id="recipes_content"
|
||||
class="recipes_content"
|
||||
:style="`height: calc(100vh - ${collapse ? 62 : 232}px)`"
|
||||
>
|
||||
<RecipesHeaderCom />
|
||||
<div id="recipes_content" class="recipes_content">
|
||||
<RecipesCom
|
||||
v-for="(item, index) in data"
|
||||
:id="`recipes${index}`"
|
||||
@ -20,22 +16,16 @@
|
||||
</template>
|
||||
<script>
|
||||
import RecipesCom from "./RecipesCom";
|
||||
import RecipesAspectCom from "./RecipesAspectCom";
|
||||
import RecipesHeaderCom from "./RecipesHeaderCom";
|
||||
export default {
|
||||
name: "RecipesView",
|
||||
components: {
|
||||
RecipesCom,
|
||||
RecipesAspectCom,
|
||||
},
|
||||
computed: {
|
||||
mCollapse() {
|
||||
return analyseData.length ? this.collapse : false;
|
||||
},
|
||||
RecipesHeaderCom,
|
||||
},
|
||||
computed: {},
|
||||
data() {
|
||||
return {
|
||||
collapse: false,
|
||||
};
|
||||
return {};
|
||||
},
|
||||
props: ["data", "analyseData", "name", "numRange"],
|
||||
};
|
||||
@ -46,6 +36,7 @@ export default {
|
||||
|
||||
.recipes_content {
|
||||
overflow: auto;
|
||||
height: calc(100vh - 48px);
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,59 @@
|
||||
</div>
|
||||
<div class="content">
|
||||
<h2>选择模板</h2>
|
||||
<!-- 筛选 -->
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true">
|
||||
<el-form-item label="模板名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入模板名称"
|
||||
@keydown.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师" prop="nutritionistId">
|
||||
<el-select
|
||||
v-model="queryParams.nutritionistId"
|
||||
placeholder="请选择营养师"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in nutritionistIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师助理" prop="nutriAssisId">
|
||||
<el-select
|
||||
v-model="queryParams.nutriAssisId"
|
||||
placeholder="请选择营养师助理"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in nutriAssisIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 模板列表 -->
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="dataList"
|
||||
@ -29,6 +82,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { listRecipesTemplate } from "@/api/custom/recipesTemplate";
|
||||
import { mapState } from "vuex";
|
||||
export default {
|
||||
name: "TemplateView",
|
||||
data() {
|
||||
@ -37,6 +91,9 @@ export default {
|
||||
dataList: [],
|
||||
total: 0,
|
||||
queryParams: {
|
||||
name: null,
|
||||
nutritionistId: null,
|
||||
nutriAssisId: null,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
reviewStatus: 2,
|
||||
@ -44,7 +101,26 @@ export default {
|
||||
};
|
||||
},
|
||||
props: ["view"],
|
||||
computed: {
|
||||
...mapState({
|
||||
//营养师
|
||||
nutritionistIdOptions: (state) =>
|
||||
state.global.nutritionistIdOptions.slice(1),
|
||||
//营养师助理
|
||||
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
handleOnBackClick() {
|
||||
this.$emit("update:view", 0);
|
||||
this.queryParams = {
|
||||
|
@ -10,9 +10,39 @@
|
||||
<RecommendView v-else />
|
||||
</div>
|
||||
<div class="right" v-loading="healthDataLoading">
|
||||
<TemplateInfoView v-if="!!temId" :data="templateInfo" />
|
||||
<HealthyView :data="healthyData" v-else-if="healthyDataType === 0" dev />
|
||||
<BodySignView :data="healthyData" v-else dev />
|
||||
<div class="top" v-if="!!recipesData.length">
|
||||
<BarChart
|
||||
v-if="analyseData.length > 1"
|
||||
:data="analyseData"
|
||||
height="160px"
|
||||
width="100%"
|
||||
:max="
|
||||
healthyData.basicBMR
|
||||
? parseFloat(
|
||||
healthyData.basicBMR.substring(
|
||||
0,
|
||||
healthyData.basicBMR.indexOf('千卡')
|
||||
)
|
||||
)
|
||||
: 0
|
||||
"
|
||||
/>
|
||||
<PieChart
|
||||
v-if="analyseData.length === 1"
|
||||
:data="analyseData"
|
||||
height="160px"
|
||||
width="100%"
|
||||
/>
|
||||
</div>
|
||||
<div class="content">
|
||||
<TemplateInfoView v-if="!!temId" :data="templateInfo" />
|
||||
<HealthyView
|
||||
:data="healthyData"
|
||||
v-else-if="healthyDataType === 0"
|
||||
dev
|
||||
/>
|
||||
<BodySignView :data="healthyData" v-else dev />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -30,6 +60,8 @@ import BodySignView from "@/components/BodySignView";
|
||||
import RecipesView from "./RecipesView/index";
|
||||
import RecommendView from "./RecommendView";
|
||||
import TemplateInfoView from "./TemplateInfoView";
|
||||
import BarChart from "./BarChart";
|
||||
import PieChart from "./PieChart";
|
||||
|
||||
export default {
|
||||
name: "BuildRecipies",
|
||||
@ -55,6 +87,8 @@ export default {
|
||||
},
|
||||
created() {},
|
||||
components: {
|
||||
BarChart,
|
||||
PieChart,
|
||||
HealthyView,
|
||||
BodySignView,
|
||||
RecipesView,
|
||||
@ -95,7 +129,15 @@ export default {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
padding-left: 20px;
|
||||
overflow: auto;
|
||||
|
||||
.top {
|
||||
height: 160px;
|
||||
}
|
||||
|
||||
.content {
|
||||
overflow: auto;
|
||||
height: calc(100% - 160px);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -56,6 +56,7 @@ export default {
|
||||
menuTypeTimeDict: {
|
||||
2: "10:00 - 10:30",
|
||||
4: "15:00 - 15:30",
|
||||
6: "21:00 - 22:00",
|
||||
},
|
||||
};
|
||||
},
|
||||
|
Reference in New Issue
Block a user