Pārlūkot izejas kodu

食物新增gi gl,完成食物gigl计算

wangyang 5 gadi atpakaļ
vecāks
revīzija
486a1c5397

+ 6 - 0
src/views/food/components/FoodDetail.vue

@@ -18,6 +18,12 @@
         <el-form-item label="ep:" prop="ep" style="margin-bottom: 40px;width: 60%">
           <el-input v-model="postForm.ep" placeholder="请输入ep" style="width: 60%" />
         </el-form-item>
+        <el-form-item label="GI:" prop="gi" style="margin-bottom: 40px;width: 60%">
+          <el-input v-model="postForm.gi" placeholder="请输入gi" style="width: 60%" />
+        </el-form-item>
+        <el-form-item label="GL:" prop="gl" style="margin-bottom: 40px;width: 60%">
+          <el-input v-model="postForm.gl" placeholder="请输入gl" style="width: 60%" />
+        </el-form-item>
         <el-form-item label="食物种类:" prop="categoryId" style="margin-bottom: 40px;width: 60%">
           <el-cascader
             v-model="postForm.categoryId"

+ 10 - 0
src/views/food/index.vue

@@ -70,6 +70,16 @@
           <span>{{ row.ep }}</span>
         </template>
       </el-table-column>
+      <el-table-column label="GI" align="center" width="70px">
+        <template slot-scope="{row}">
+          <span>{{ row.gi }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="GL" align="center" width="70px">
+        <template slot-scope="{row}">
+          <span>{{ row.gl ? row.gl : row.glCalcd }}</span>
+        </template>
+      </el-table-column>
       <el-table-column label="创建时间" width="180px" align="center">
         <template slot-scope="{row}">
           <span>{{ row.createTime }}</span>

+ 0 - 34
src/views/foodModifier/index.vue

@@ -156,40 +156,6 @@ export default {
       }).catch(res => {
         this.$message.error(res.data.message)
       })
-      // try {
-      //   const nutrientRes = await getNutrientList(row.foodId)
-      //   const nutrients = nutrientRes.data
-      //   const foodUnitRes = await convertFoodUnit(row.foodId, { fromUnit: row.inInitUnit })
-      //   const foodUnitRatio = foodUnitRes.data.ratio
-      //   if (!foodUnitRatio) {
-      //     this.dialogHtml = ''
-      //     return
-      //   }
-      //   let unitPairs = []
-      //   nutrients.forEach(item => unitPairs.push({ fromUnit: }))
-      //   const convertedUnits = await convertUnits()
-      //
-      //
-      // } catch {
-      //   this.$message.error('获取数据失败')
-      // }
-      //
-      //     this.dialogHtml = `转换关系:1${row.inInitUnit}${this.food.name}=${res.data.ratio}${this.food.normalizedUnit}${this.food.name}<br>`
-      //     this.dialogHtml += `${row.inInit}${row.inInitUnit}${this.food.name}含有如下营养素:<br>`
-      //     this.dialogHtml += `******************************<br>`
-      //     for (let i=0; i < nutrients.length; i++) {
-      //       const nutrient = nutrients[i]
-      //       const quantity = nutrient.normalizedQuantity * res.data.ratio * row.inInit
-      //       this.dialogHtml += `${nutrient.nutrientName}:${quantity}${nutrient.unit}。<br>`
-      //       this.dialogHtml += `营养素计量为:${nutrient.quantity}${nutrient.unit}。Nv_Spec为:${nutrient.nvSpec}${nutrient.nvSpecUnit}。<br>`
-      //       this.dialogHtml += `******************************<br>`
-      //     }
-      //     this.dialogFormVisible = true
-      //     this.di
-      //     })
-      // }).catch(res => {
-      //   this.$message.error('获取数据失败')
-      // })
     }
   }
 }