|
@@ -7,12 +7,14 @@
|
|
|
ref="nutrientSelect"
|
|
ref="nutrientSelect"
|
|
|
v-model="params.nutrientId"
|
|
v-model="params.nutrientId"
|
|
|
filterable
|
|
filterable
|
|
|
|
|
+ clearable
|
|
|
remote
|
|
remote
|
|
|
reserve-keyword
|
|
reserve-keyword
|
|
|
style="width: 200px;margin-left: 10px;"
|
|
style="width: 200px;margin-left: 10px;"
|
|
|
placeholder="请输入营养素关键词"
|
|
placeholder="请输入营养素关键词"
|
|
|
:remote-method="queryNutrients"
|
|
:remote-method="queryNutrients"
|
|
|
:loading="loading"
|
|
:loading="loading"
|
|
|
|
|
+ @change="nutrientChanged"
|
|
|
>
|
|
>
|
|
|
<el-option v-for="item in nutrients" :key="item.id" :label="item.name" :value="item.id" />
|
|
<el-option v-for="item in nutrients" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
</el-select>
|
|
</el-select>
|
|
@@ -20,7 +22,7 @@
|
|
|
<el-autocomplete
|
|
<el-autocomplete
|
|
|
class="inline-input"
|
|
class="inline-input"
|
|
|
v-model="params.unit"
|
|
v-model="params.unit"
|
|
|
- :fetch-suggestions="queryNutrientUnits(params.nutrientId)"
|
|
|
|
|
|
|
+ :fetch-suggestions="(query, cb) => {queryNutrientUnits(query, row.nutrientId, cb)}"
|
|
|
@input="handleUnitChanged"
|
|
@input="handleUnitChanged"
|
|
|
placeholder="单位关键词"
|
|
placeholder="单位关键词"
|
|
|
/>
|
|
/>
|
|
@@ -90,7 +92,7 @@
|
|
|
class="inline-input"
|
|
class="inline-input"
|
|
|
v-model="row.unit"
|
|
v-model="row.unit"
|
|
|
@input="handleRowUnitChanged(row)"
|
|
@input="handleRowUnitChanged(row)"
|
|
|
- :fetch-suggestions="queryNutrientUnits(row.nutrientId)"
|
|
|
|
|
|
|
+ :fetch-suggestions="(query, cb) => {queryNutrientUnits(query, row.nutrientId, cb)}"
|
|
|
placeholder="单位关键词"
|
|
placeholder="单位关键词"
|
|
|
/>
|
|
/>
|
|
|
<el-select
|
|
<el-select
|
|
@@ -400,6 +402,19 @@ export default {
|
|
|
},
|
|
},
|
|
|
isPercentByVolumeUnit(row) {
|
|
isPercentByVolumeUnit(row) {
|
|
|
return row && row.unit === '%Vol'
|
|
return row && row.unit === '%Vol'
|
|
|
|
|
+ },
|
|
|
|
|
+ nutrientChanged(value) {
|
|
|
|
|
+ for (let nutrient of this.nutrients) {
|
|
|
|
|
+ if (nutrient.id === value) {
|
|
|
|
|
+ this.$set(this.params, 'unit', nutrient.baseUnit)
|
|
|
|
|
+ if (nutrient.nrvUnit) {
|
|
|
|
|
+ this.showNRV = true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.showNRV = false
|
|
|
|
|
+ }
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|