|
|
@@ -28,7 +28,7 @@
|
|
|
class="filter-item"
|
|
|
/>
|
|
|
<el-select
|
|
|
- v-model="params.unitName"
|
|
|
+ v-model="params.unit"
|
|
|
style="width: 200px;margin-left: 10px;"
|
|
|
>
|
|
|
<el-option
|
|
|
@@ -67,7 +67,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="用量" align="center">
|
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.quantity + row.unitName }}</span>
|
|
|
+ <span>{{ row.quantity + row.unit }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="主材/辅材" align="center">
|
|
|
@@ -87,7 +87,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getFoodBriefInfos } from '@/api/food'
|
|
|
+import { getList, getFoodAllUnits } from '@/api/food'
|
|
|
import { getRecipeFoods, addFood, removeRecipeFood } from '@/api/recipe'
|
|
|
|
|
|
const foodTypeMapping = { 0: '主材', 1: '辅材' }
|
|
|
@@ -129,7 +129,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
queryFoods(query) {
|
|
|
- getFoodBriefInfos({ query }).then(res => {
|
|
|
+ getList({ query }).then(res => {
|
|
|
this.foods = res.data.list
|
|
|
}).catch(() => {
|
|
|
this.foods = []
|
|
|
@@ -137,15 +137,12 @@ export default {
|
|
|
},
|
|
|
changeUnits(value) {
|
|
|
this.units = []
|
|
|
- for (let i=0; i < this.foods.length; i++) {
|
|
|
- if (this.foods[i].id === value){
|
|
|
- this.units = this.foods[i].unitNames
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
+ getFoodAllUnits(value).then(res => {
|
|
|
+ this.units = res.data.list
|
|
|
+ })
|
|
|
},
|
|
|
addFood() {
|
|
|
- if (!this.params.foodId || !this.params.unitName || !this.params.quantity) {
|
|
|
+ if (!this.params.foodId || !this.params.unit || !this.params.quantity) {
|
|
|
this.$message.error('请完善录入信息')
|
|
|
return
|
|
|
}
|