|
@@ -12,15 +12,8 @@
|
|
|
<span>配餐日期:</span>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-date-picker
|
|
|
- v-model="mealTimeRange"
|
|
|
- type="daterange"
|
|
|
- range-separator="-"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期"
|
|
|
- style="width: 100%"
|
|
|
- @keydown.enter.prevent
|
|
|
- />
|
|
|
+ <el-date-picker v-model="mealTimeRange" type="daterange" range-separator="-" start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期" style="width: 100%" @keydown.enter.prevent />
|
|
|
</el-col>
|
|
|
<el-col :span="3">
|
|
|
<el-button type="primary" @click.prevent="addRecipe">新增食谱</el-button>
|
|
@@ -34,42 +27,30 @@
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<div class="tab-bar">
|
|
|
- <el-button
|
|
|
- v-for="(recipe, index) in allTableData"
|
|
|
- :key="index"
|
|
|
- :type="currentRecipe === index ? 'success' : 'info'"
|
|
|
- plain
|
|
|
- icon="Document"
|
|
|
- class="tab-btn"
|
|
|
- :class="{active: currentRecipe === index}"
|
|
|
- @click="switchRecipe(index)"
|
|
|
- >
|
|
|
+ <el-button v-for="(recipe, index) in allTableData" :key="index"
|
|
|
+ :type="currentRecipe === index ? 'success' : 'info'" plain icon="Document" class="tab-btn"
|
|
|
+ :class="{ active: currentRecipe === index }" @click="switchRecipe(index)">
|
|
|
食谱{{ index + 1 }}
|
|
|
<el-icon class="close-icon" @click.stop="deleteRecipe(index)" v-if="allTableData.length > 1">
|
|
|
<Close />
|
|
|
</el-icon>
|
|
|
</el-button>
|
|
|
</div>
|
|
|
- <el-alert
|
|
|
- title="周食谱模板的食谱数量小于7时,食谱可循环使用"
|
|
|
- type="warning"
|
|
|
- show-icon
|
|
|
- class="mb-2 info-alert"
|
|
|
- :closable="false"
|
|
|
- style="background: transparent; border: none; color: #ff9900"
|
|
|
- />
|
|
|
+ <el-alert title="周食谱模板的食谱数量小于7时,食谱可循环使用" type="warning" show-icon class="mb-2 info-alert" :closable="false"
|
|
|
+ style="background: transparent; border: none; color: #ff9900" />
|
|
|
|
|
|
<el-table :data="tableData" class="diet-table" border>
|
|
|
- <el-table-column prop="meal" label="餐次" width="200px" align="center" />
|
|
|
- <el-table-column prop="time" label="用餐时间" width="260px" align="center">
|
|
|
- <template #default="{row}">
|
|
|
+ <el-table-column prop="meal" label="餐次" width="100px" align="center" />
|
|
|
+ <el-table-column prop="time" label="用餐时间" width="150px" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
<el-time-select v-model="row.time" start="06:00" step="00:30" end="22:00" placeholder="选择时间" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="menuName" label="食谱名称" width="350px" align="center">
|
|
|
- <template #default="{row}">
|
|
|
+ <el-table-column prop="menuName" label="食谱名称" width="200px" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
<div class="recipe-list">
|
|
|
- <div v-if="!row.recipes?.length" class="recipe-input" @click.stop.prevent="openRecipeDialog(row)">请选择</div>
|
|
|
+ <div v-if="!row.recipes?.length" class="recipe-input" @click.stop.prevent="openRecipeDialog(row)">请选择
|
|
|
+ </div>
|
|
|
<template v-else>
|
|
|
<div v-for="(recipe, index) in row.recipes" :key="recipe.id" class="recipe-item">
|
|
|
<div class="recipe-input" @click.stop.prevent="openRecipeDialog(row, index)">
|
|
@@ -86,8 +67,8 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="categoryName" label="食谱分类" width="220px" align="center">
|
|
|
- <template #default="{row}">
|
|
|
+ <el-table-column prop="categoryName" label="食谱分类" width="150px" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
<div v-for="recipe in row.recipes" :key="recipe.id" class="recipe-item">
|
|
|
<div class="recipe-input-one">
|
|
|
{{ recipe.categoryName }}
|
|
@@ -95,8 +76,8 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="count" label="份数" width="220px" align="center">
|
|
|
- <template #default="{row}">
|
|
|
+ <el-table-column prop="count" label="份数" width="150px" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
<el-input-number v-model="row.count" :min="1" :max="99" @change="updateRowData(row)" size="small" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -105,8 +86,8 @@
|
|
|
<span>{{ row.weight || '-' }}</span>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
- <el-table-column label="食材重量" align="center">
|
|
|
- <template #default="{row}">
|
|
|
+ <el-table-column label="食材重量" width="100px" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
<div v-if="row.recipes && row.recipes.length">
|
|
|
<div v-for="recipe in row.recipes" :key="recipe.id">
|
|
|
{{ getRecipeWeight(recipe, row.count) }}
|
|
@@ -115,8 +96,8 @@
|
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="calorie" label="热量" align="center">
|
|
|
- <template #default="{row}">
|
|
|
+ <el-table-column prop="calorie" width="100px" label="热量" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
<div v-if="row.recipes && row.recipes.length">
|
|
|
<div v-for="recipe in row.recipes" :key="recipe.id">
|
|
|
{{ getRecipeCalorie(recipe, row.calorie) }}
|
|
@@ -125,8 +106,8 @@
|
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="金额" align="center">
|
|
|
- <template #default="{row}">
|
|
|
+ <el-table-column label="金额" width="100px" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
<div v-if="row.recipes && row.recipes.length">
|
|
|
<div v-for="recipe in row.recipes" :key="recipe.id">
|
|
|
{{ getRecipeAmount(recipe, row.count) }}
|
|
@@ -144,7 +125,7 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 底部按钮卡片 -->
|
|
|
- <div class="bottom-btn-card">
|
|
|
+ <div>
|
|
|
<div class="btn-wrapper">
|
|
|
<el-button type="info" plain @click="saveDraft">存为草稿</el-button>
|
|
|
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
|
@@ -158,16 +139,16 @@
|
|
|
<RecipeTemplate ref="recipeTemplateRef" @confirm="handleRecipeTemplateConfirm" />
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
-import {ref, onMounted, computed, watch, nextTick} from 'vue';
|
|
|
-import {MealPlanVO} from '@/api/patients/hospitalMealPlan/types';
|
|
|
+import { ref, onMounted, computed, watch, nextTick } from 'vue';
|
|
|
+import { MealPlanVO } from '@/api/patients/hospitalMealPlan/types';
|
|
|
|
|
|
import * as echarts from 'echarts';
|
|
|
import CommonDialog from './components/CommonDialog.vue';
|
|
|
import RecipeTemplate from './components/RecipeTemplate.vue';
|
|
|
const emit = defineEmits(['goBack', 'submitHospital']);
|
|
|
-import {MealRecipeForm} from '@/api/patients/hospitalMealRecipe/types';
|
|
|
-import {ElMessage} from 'element-plus';
|
|
|
-import {useHospitalStore} from '@/store/modules/hospital';
|
|
|
+import { MealRecipeForm } from '@/api/patients/hospitalMealRecipe/types';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import { useHospitalStore } from '@/store/modules/hospital';
|
|
|
|
|
|
const useStore = useHospitalStore();
|
|
|
|
|
@@ -250,9 +231,9 @@ const calculateTotalPrice = () => {
|
|
|
};
|
|
|
|
|
|
const nutritionData = ref([
|
|
|
- {name: '蛋白质', weight: '', ratio: 0, reference: '10% - 15%'},
|
|
|
- {name: '脂肪', weight: '', ratio: 0, reference: '20% - 30%'},
|
|
|
- {name: '碳水化合物', weight: '', ratio: 0, reference: '50% - 65%'}
|
|
|
+ { name: '蛋白质', weight: '', ratio: 0, reference: '10% - 15%' },
|
|
|
+ { name: '脂肪', weight: '', ratio: 0, reference: '20% - 30%' },
|
|
|
+ { name: '碳水化合物', weight: '', ratio: 0, reference: '50% - 65%' }
|
|
|
]);
|
|
|
|
|
|
const initialTableData: TableRow[] = [
|
|
@@ -537,7 +518,7 @@ const handleRecipeConfirm = (selectedRecipes: Recipe[]) => {
|
|
|
};
|
|
|
|
|
|
// 处理食谱取消
|
|
|
-const handleRecipeCancel = () => {};
|
|
|
+const handleRecipeCancel = () => { };
|
|
|
|
|
|
// 移除食谱
|
|
|
const removeRecipe = (row: TableRow, index: number) => {
|
|
@@ -642,7 +623,7 @@ watch(
|
|
|
() => {
|
|
|
loadDraft();
|
|
|
},
|
|
|
- {immediate: true}
|
|
|
+ { immediate: true }
|
|
|
);
|
|
|
|
|
|
// 监听食谱数据变化,重新计算总价格
|
|
@@ -651,7 +632,7 @@ watch(
|
|
|
() => {
|
|
|
calculateTotalPrice();
|
|
|
},
|
|
|
- {deep: true}
|
|
|
+ { deep: true }
|
|
|
);
|
|
|
|
|
|
// 监听当前食谱切换,重新计算总价格
|
|
@@ -764,7 +745,7 @@ watch(
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- {immediate: true}
|
|
|
+ { immediate: true }
|
|
|
);
|
|
|
|
|
|
onMounted(() => {
|