|
|
@@ -132,7 +132,7 @@ export default {
|
|
|
if (this.params.nutrientId) {
|
|
|
addTemplateNutrient(this.templateId, this.params).then(res => {
|
|
|
this.fetchNutrients()
|
|
|
- this.$message.success('添加成功')
|
|
|
+ this.$notify.success('添加成功')
|
|
|
this.params = {}
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs['nutrientSelect'].focus()
|
|
|
@@ -163,6 +163,13 @@ export default {
|
|
|
getNutrients(this.templateId).then(res => {
|
|
|
this.list = res.data
|
|
|
this.listLoading = false
|
|
|
+ if (this.list.length > 0) {
|
|
|
+ this.$set(this.params, "nvSpec", this.list[0].nvSpec)
|
|
|
+ this.$set(this.params, "nvSpecUnit", this.list[0].nvSpecUnit)
|
|
|
+ } else {
|
|
|
+ this.$set(this.params, 'nvSpec', null)
|
|
|
+ this.$set(this.params, 'nvSpecUnit', null)
|
|
|
+ }
|
|
|
}).catch(() => {
|
|
|
this.$message.error('获取数据失败')
|
|
|
this.listLoading = false
|
|
|
@@ -172,7 +179,7 @@ export default {
|
|
|
removeNutrient(row) {
|
|
|
removeNutrient(this.templateId, row.nutrientId).then(res => {
|
|
|
this.fetchNutrients()
|
|
|
- this.$message.success('提交成功')
|
|
|
+ this.$notify.success('提交成功')
|
|
|
}).catch(res => {
|
|
|
this.fetchNutrients()
|
|
|
this.$message.error(res.data.message)
|