Explorar el Código

feat(admin): update Foods.vue table columns and dialog fields with full nutrition input

Xiaogang Liao hace 2 meses
padre
commit
0e1fbb93b7
Se han modificado 1 ficheros con 26 adiciones y 5 borrados
  1. 26 5
      cfc-web/src/views/admin/Foods.vue

+ 26 - 5
cfc-web/src/views/admin/Foods.vue

@@ -29,8 +29,14 @@
         <el-table-column prop="id" label="ID" width="80" />
         <el-table-column prop="name" label="名称" />
         <el-table-column prop="category" label="分类" width="100" />
-        <el-table-column prop="kcalPer100g" label="热量(kcal)" width="100" />
+        <el-table-column prop="calories" label="热量(kcal)" width="100" />
         <el-table-column prop="protein" label="蛋白质(g)" width="100" />
+        <el-table-column prop="carbs" label="碳水(g)" width="100" />
+        <el-table-column prop="fat" label="脂肪(g)" width="100" />
+        <el-table-column prop="fiber" label="膳食纤维(g)" width="100" />
+        <el-table-column prop="energyKj" label="能量(kJ)" width="100" />
+        <el-table-column prop="starch" label="淀粉(g)" width="100" />
+        <el-table-column prop="cholesterol" label="胆固醇(mg)" width="100" />
         <el-table-column prop="status" label="状态" width="80" />
         <el-table-column label="操作" width="160">
           <template slot-scope="{ row }">
@@ -61,7 +67,7 @@
           </el-select>
         </el-form-item>
         <el-form-item label="热量(kcal/100g)">
-          <el-input-number v-model="form.kcalPer100g" :min="0" style="width:100%" />
+          <el-input-number v-model="form.calories" :min="0" style="width:100%" />
         </el-form-item>
         <el-form-item label="蛋白质(g)">
           <el-input-number v-model="form.protein" :min="0" :precision="1" style="width:100%" />
@@ -75,6 +81,15 @@
         <el-form-item label="膳食纤维(g)">
           <el-input-number v-model="form.fiber" :min="0" :precision="1" style="width:100%" />
         </el-form-item>
+        <el-form-item label="能量(kJ/100g)">
+          <el-input-number v-model="form.energyKj" :min="0" style="width:100%" />
+        </el-form-item>
+        <el-form-item label="淀粉(g/100g)">
+          <el-input-number v-model="form.starch" :min="0" :precision="1" style="width:100%" />
+        </el-form-item>
+        <el-form-item label="胆固醇(mg/100g)">
+          <el-input-number v-model="form.cholesterol" :min="0" :precision="1" style="width:100%" />
+        </el-form-item>
         <el-form-item label="单位">
           <el-input v-model="form.unit" placeholder="如: 克、个、份" />
         </el-form-item>
@@ -106,11 +121,14 @@ export default {
       form: {
         name: '',
         category: '',
-        kcalPer100g: 0,
+        calories: 0,
         protein: 0,
         carbs: 0,
         fat: 0,
         fiber: 0,
+        energyKj: 0,
+        starch: 0,
+        cholesterol: 0,
         unit: '克',
         status: 'active'
       }
@@ -138,7 +156,7 @@ export default {
     },
     openCreate() {
       this.editId = null
-      this.form = { name: '', category: '', kcalPer100g: 0, protein: 0, carbs: 0, fat: 0, fiber: 0, unit: '克', status: 'active' }
+      this.form = { name: '', category: '', calories: 0, protein: 0, carbs: 0, fat: 0, fiber: 0, energyKj: 0, starch: 0, cholesterol: 0, unit: '克', status: 'active' }
       this.dialogVisible = true
     },
     editItem(row) {
@@ -146,11 +164,14 @@ export default {
       this.form = {
         name: row.name || '',
         category: row.category || '',
-        kcalPer100g: row.kcalPer100g || 0,
+        calories: row.calories || 0,
         protein: row.protein || 0,
         carbs: row.carbs || 0,
         fat: row.fat || 0,
         fiber: row.fiber || 0,
+        energyKj: row.energyKj || 0,
+        starch: row.starch || 0,
+        cholesterol: row.cholesterol || 0,
         unit: row.unit || '克',
         status: row.status || 'active'
       }