Переглянути джерело

修复信息来源相关bug

wangyang 5 роки тому
батько
коміт
2b82f74c5e

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

@@ -113,6 +113,7 @@ export default {
       this.foodId = this.$route.params && this.$route.params.id
       this.fetchData(this.foodId)
     }
+    this.queryTemplates()
   },
   methods: {
     fetchData(id) {

+ 2 - 2
src/views/food/nutrient.vue

@@ -180,7 +180,7 @@ export default {
       foodId: '',
       list: [],
       nutrients: [],
-      params: {},
+      params: { source: '营养标签' },
       loading: false,
       unitLoading: false,
       sources: [{ value: "营养标签" }, { value: "食品官方资料" }, { value: "计算值" }]
@@ -204,7 +204,7 @@ export default {
     addNutrient() {
       this.params.foodId = this.foodId
       addFoodNutrient(this.foodId, this.params).then(res => {
-        this.params = {}
+        this.params = { source: '营养标签' }
         this.fetchData()
         this.$notify.success('添加营养素成功')
         this.$refs.nutrientSelect.focus()

+ 2 - 2
src/views/nutrientTemplate/detail.vue

@@ -172,7 +172,7 @@ export default {
       list: [],
       units: [],
       nutrients: [],
-      params: {},
+      params: { source: '营养标签' },
       loading: false,
       unitLoading: false,
       sources: [{ value: "营养标签" }, { value: "食品官方资料" }, { value: "计算值" }],
@@ -198,7 +198,7 @@ export default {
         addTemplateNutrient(this.templateId, this.params).then(res => {
           this.fetchNutrients()
           this.$notify.success('添加成功')
-          this.params = {}
+          this.params = { source: '营养标签' }
           this.$nextTick(() => {
             this.$refs['nutrientSelect'].focus()
           })